On Fri, 20 Oct 2023 at 18:35, Luca Fancellu <luca.fance...@arm.com> wrote:
> > > > On 20 Oct 2023, at 16:57, Erez <erezge...@gmail.com> wrote: > > > > Hi, > > > > Your statement is correct, but not the implementation. > > You need to export CC from the makefile, to get > > CC = $(CROSS_COMPILE)gcc > > Value. > > In your patch CC may have a different value. > > > > I would use: > > " > > CC := $(CROSS_COMPILE)gcc > > export CC > > " > > > > Yes assign with ":=", see > https://www.gnu.org/software/make/manual/html_node/Setting.html > > > > Erez > > Hi Erez, > > I think you are right, but your solution doesn’t seems to work either > (I’ve tried with a dummy Makefile). > *variables marked with export are only available to [the shells launched for] recipe commands* (commands that are part of rules), regrettably *not to invocations of $(shell ...)* > In Yocto it is working because Yocto exports CC already when calling make. > > But I can do these changes (on top of mine) and it should work: > > diff --git a/incdefs.sh b/incdefs.sh > index 391e63c7fac6..55031657a93e 100755 > --- a/incdefs.sh > +++ b/incdefs.sh > @@ -18,6 +18,8 @@ > # with this program; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > > +CC=$1 > + > # > # Look for functional prototypes in the C library. > # > diff --git a/makefile b/makefile > index 3e3b8b35fc96..5e1de75834a8 100644 > --- a/makefile > +++ b/makefile > @@ -39,7 +39,7 @@ OBJECTS = $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o > phc_ctl.o pmc.o pmc_agent.o \ > SRC = $(OBJECTS:.o=.c) > DEPEND = $(OBJECTS:.o=.d) > srcdir := $(dir $(lastword $(MAKEFILE_LIST))) > -incdefs := $(shell $(srcdir)/incdefs.sh) > +incdefs := $(shell $(srcdir)/incdefs.sh "$(CC)") > version := $(shell $(srcdir)/version.sh $(srcdir)) > VPATH = $(srcdir) > > What do you think? > How about $(shell CC=${CC} ./incdefs.sh) And we can change CC to CC ?= ... In case CC comes from the build, like in Yocto and Debian. Erez > > > > > > > > > > > On Thu, 19 Oct 2023 at 17:10, Luca Fancellu <luca.fance...@arm.com> > wrote: > > The Makefile is defining CC and incdefs.sh is using > > ${CROSS_COMPILE}cpp inside it, allowing both to use different > > compilers depending on what the user pass during make invocation > > as CC. > > > > Align them using ${CC} also inside incdefs.sh > > > > Signed-off-by: Luca Fancellu <luca.fance...@arm.com> > > --- > > incdefs.sh | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/incdefs.sh b/incdefs.sh > > index a9e94f777f6b..391e63c7fac6 100755 > > --- a/incdefs.sh > > +++ b/incdefs.sh > > @@ -27,7 +27,7 @@ user_flags() > > printf " -D_GNU_SOURCE" > > > > # Get list of directories searched for header files. > > - dirs=$(echo "" | ${CROSS_COMPILE}cpp -Wp,-v 2>&1 >/dev/null | > grep ^" /") > > + dirs=$(${CC} -E -Wp,-v -xc /dev/null 2>&1 >/dev/null | grep ^" > /") > > > > # Look for clock_adjtime(). > > for d in $dirs; do > > -- > > 2.34.1 > > > > > > > > _______________________________________________ > > Linuxptp-devel mailing list > > Linuxptp-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/linuxptp-devel > > IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. >
_______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel