From: David Sharp <dhsharp@google.com> To: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org>, Jiri Olsa <jolsa@redhat.com>, Arnaldo Carvalho de Melo <acme@redhat.com>, Josh Poimboeuf <jpoimboe@redhat.com>, Lucas Stach <l.stach@pengutronix.de>, Jiri Olsa <jolsa@kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, kernel@pengutronix.de, patchwork-lst@pengutronix.de, Wang Nan <wangnan0@huawei.com> Subject: Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker Date: Tue, 22 Mar 2016 11:22:53 -0700 [thread overview] Message-ID: <CAJL_eks51cRSvjpw-=ViEjQbVxxqh9pZttaU_ekoVdXoNXsdAg@mail.gmail.com> (raw) In-Reply-To: <20160322144258.GC25862@kernel.org> On Tue, Mar 22, 2016 at 7:42 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > Em Tue, Mar 22, 2016 at 08:50:42AM -0400, Steven Rostedt escreveu: >> On Tue, 22 Mar 2016 08:10:10 +0100 >> Jiri Olsa <jolsa@redhat.com> wrote: >> >> > On Mon, Mar 21, 2016 at 05:40:30PM -0300, Arnaldo Carvalho de Melo wrote: >> > > Em Mon, Mar 21, 2016 at 09:08:52AM +0100, Jiri Olsa escreveu: >> > > > On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote: >> > > > > Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu: >> > > > > > So 'allow-override' would probably be a good option. >> > > >> > > > > Humm, my preference is to make tools/ look like the kernel, and the >> > > > > kernel doesn't use that allow-override thing, right? So perhaps add what >> > > > > is missing to make it look exactly like the kernel and then ditch this >> > > > > allow-override thing? >> > > >> > > > Steven explained his reason for allow-override in the comment above it, >> > > > please make sure the new solution follows that >> > > >> > > Sure, and I'm no make guru, but what puzzles me is why isn't this >> > > required in: >> > > >> > > [acme@jouet linux]$ grep -w ^CC Makefile >> > > CC = $(CROSS_COMPILE)gcc This works, but doesn't allow setting CC from env since it is unconditionally overwritten here. >> > > [acme@jouet linux]$ >> > >> > Steve has special requirements I guess ;-) CC-ed >> > >> >> I just copied what I had in trace-cmd. David Sharp is the one that >> added that code. >> >> Link: http://lkml.kernel.org/r/1299791491-1805-1-git-send-email-dhsharp@google.com > > David, so, what was the usecase for that? Something we can try to > reproduce so that we can check if the kernel solution covers your > specific case? > > - Arnaldo It was a very long time ago, so I don't fully remember my specific requirements at the time. However, I'm sure I was wanting to set just "CROSS_COMPILE" from the environment rather than all of CC, LD, AS, AR, etc, while still allowing the flexibility to set CC, etc from the environment. If you have just: CC ?= $(CROSS_COMPILE)gcc well, that line will never have any effect (not even the value of "gcc"), because CC is already set by default by make itself (to "cc"). Demo (gmail won't let me paste tabs, so you'll have to fix the tabs in the "all" rule): """ $ cat Makefile define allow-override $(if $(or $(findstring environment,$(origin $(1))),\ $(findstring command line,$(origin $(1)))),,\ $(eval $(1) = $(2))) endef CC ?= $(CROSS_COMPILE)gcc $(call allow-override,cross_CC,$(CROSS_COMPILE)gcc) all: @echo "CC: $(CC)" @echo "cross_CC: $(cross_CC)" $ make -f Makefile CC: cc cross_CC: gcc $ CC=other-gcc cross_CC=other-gcc make -f Makefile CC: other-gcc cross_CC: other-gcc $ CROSS_COMPILE=cross- make -f Makefile CC: cc cross_CC: cross-gcc """ So, note that without allow-override: - The set default of "gcc" is not respected. - Setting CC from the env does work. - Setting CROSS_COMPILE from the env is not effective. Hence the title of the patch and macro: "Makefiles suck". ;)
next prev parent reply other threads:[~2016-03-22 18:23 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-03-17 17:27 Lucas Stach 2016-03-18 16:25 ` Arnaldo Carvalho de Melo 2016-03-18 16:38 ` Josh Poimboeuf 2016-03-18 16:43 ` Josh Poimboeuf 2016-03-18 17:39 ` Arnaldo Carvalho de Melo 2016-03-18 16:45 ` Arnaldo Carvalho de Melo 2016-03-18 17:16 ` Josh Poimboeuf 2016-03-18 17:38 ` Arnaldo Carvalho de Melo 2016-03-18 17:42 ` Josh Poimboeuf 2016-03-21 8:08 ` Jiri Olsa 2016-03-21 20:40 ` Arnaldo Carvalho de Melo 2016-03-22 7:10 ` Jiri Olsa 2016-03-22 12:50 ` Steven Rostedt 2016-03-22 14:42 ` Arnaldo Carvalho de Melo 2016-03-22 18:22 ` David Sharp [this message] 2016-03-22 18:38 ` David Sharp 2016-06-01 9:18 ` Lucas Stach 2016-06-01 13:07 ` Arnaldo Carvalho de Melo 2016-06-08 8:37 ` [tip:perf/core] tools lib api: Respect " tip-bot for Lucas Stach
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAJL_eks51cRSvjpw-=ViEjQbVxxqh9pZttaU_ekoVdXoNXsdAg@mail.gmail.com' \ --to=dhsharp@google.com \ --cc=acme@kernel.org \ --cc=acme@redhat.com \ --cc=jolsa@kernel.org \ --cc=jolsa@redhat.com \ --cc=jpoimboe@redhat.com \ --cc=kernel@pengutronix.de \ --cc=l.stach@pengutronix.de \ --cc=linux-kernel@vger.kernel.org \ --cc=patchwork-lst@pengutronix.de \ --cc=rostedt@goodmis.org \ --cc=wangnan0@huawei.com \ --subject='Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.