Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Henrik,

On Tue, Jan 05, 2016 at 10:15:56PM +0100, Henrik Austad wrote:
> On Mon, Jan 04, 2016 at 05:25:07PM +0100, Uwe Kleine-König wrote:
> > On Mon, Jan 04, 2016 at 08:20:01AM -0800, Khem Raj wrote:
> > > 
> > > > On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@xxxxxxxxxxxxxx> wrote:
> > > > 
> > > > I believe the patch does not have the desired effect, because make(1)
> > > > always sets CC automatically:
> > > > 
> > > > $ cat raj.mk
> > > > CROSS_COMPILE=x86_64-linux-gnu-
> > > > CC?=$(CROSS_COMPILE)gcc
> > > > .PHONY: default
> > > > default:
> > > > 	@echo CC=$(CC)
> > > > $ make -f raj.mk
> > > > CC=cc
> > > > 
> > > > With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
> > > > are different, will get different (worse) behavior.
> > > 
> > > Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
> > > in Makefile then my issue would be fixed too. However this would mean that cross compiling users
> > > now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
> > > acceptable ?
> > 
> > You could play with something like:
> > 
> > ifeq($(origin CC),default)
> > CC=$(CROSS_COMPILE)gcc
> > endif
> > 
> > but not sure I'd like the result. If you asked me, I'd drop all that
> > CROSS_COMPILE stuff.
> 
> Why? Isn't this the normal way of triggering cross-compile? AFIAK, that's 
> how the kernel does it, and that seems like a pretty sane way.

No, the normal thing to trigger a cross-compile is

	./configure --build=amd64 --host=mips-elf

:-)

For plain make project with no special support for cross compiling
(which is the norm today), the right incarnation is:

	make CC=arm-v5te-linux-gnueabi-gcc

and IMHO that's good enough. (Sometimes you also have to pass CXX, in
rare cases even more.)

> And yes, I compile rt-tests to several architectures, so I'm quite fond of 
> the CROSS_COMPILE switch. In fact, I might get cross if you cross it out :)

I don't care much, because if I cross compile rt-tests someone else
already found out for me how to do it, I only have to enable it in my
config :-)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux