allow CROSS_COMPILE override
PATCH 1/1 allow CROSS_COMPILE override
Anybody would object this? It allows one to override CROSS_COMPILE from command line or top-level Makefile.
Jun
arch/mips/Makefile renamed from arch/mips/Makefile.orig +3 -1
@@ -23,7 +23,9 @@ endif ifdef CONFIG_CROSSCOMPILE -CROSS_COMPILE = $(tool-prefix) + ifndef CROSS_COMPILE + CROSS_COMPILE = $(tool-prefix) + endif endif #
Quoted 2 lines · Jun Sun
Anybody would object this? It allows one to override
Why not but this is less messy:
mips/Makefile 20 Feb 2003 21:10:30 -0000 renamed from mips/Makefile 13 Dec 2002 23:41:09 -0000 1.1.1.8 +0 -0
@@ -23,7 +23,7 @@
endif
ifdef CONFIG_CROSSCOMPILE
-CROSS_COMPILE = $(tool-prefix)
+CROSS_COMPILE ?= $(tool-prefix)
endif
#
/Brian
Is this allowed? Can't find any such usage in kernel other than the worrisome comment below:
arch/arm/Makefile:# Grr, ?= doesn't work as all the other assignment operators do. Make bug?
Jun
Quoted 20 lines · Brian Murphy
Quoted 2 lines · Jun Sun
Anybody would object this? It allows one to override
Why not but this is less messy:
mips/Makefile 20 Feb 2003 21:10:30 -0000 renamed from mips/Makefile 13 Dec 2002 23:41:09 -0000 1.1.1.8 +1
-1@@ -23,7 +23,7 @@ endif ifdef CONFIG_CROSSCOMPILE -CROSS_COMPILE = $(tool-prefix) +CROSS_COMPILE ?= $(tool-prefix) endif #/Brian
Quoted 8 lines · Jun Sun
Is this allowed? Can't find any such usage in kernel other than the worrisome comment below:
arch/arm/Makefile:# Grr, ?= doesn't work as all the other assignment operators do. Make bug?
It worked for me when I tested the patch, at least for this simple case. Might have something to do with the make version, when was the comment written?
brm@brian:~$ make -v GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
/Brian
Quoted 10 lines · Brian Murphy
Quoted 8 lines · Jun Sun
Is this allowed? Can't find any such usage in kernel other than the worrisome comment below:
arch/arm/Makefile:# Grr, ?= doesn't work as all the other assignment operators do. Make bug?
Quoted 6 lines
It worked for me when I tested the patch, at least for this simple case. Might have something to do with the make version, when was the comment written?
brm@brian:~$ make -v GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
I know for a fact that this syntax works for me on RH7.3 because we use it heavily in a bunch of tools makefiles.
Pete
Quoted 8 lines · Jun Sun
Is this allowed? Can't find any such usage in kernel other than the worrisome comment below:
arch/arm/Makefile:# Grr, ?= doesn't work as all the other assignment operators do. Make bug?
The arm code does this:
# Only set INCDIR if its not already defined above
# Grr, ?= doesn't work as all the other assignment operators do. Make bug? ifeq ($(origin INCDIR), undefined)
INCDIR := $(MACHINE)
endif
where the make docs say:
INCDIR ?= $(MACHINE)
is the same as
ifeq ($(origin INCDIR), undefined)
INCDIR = $(MACHINE)
endif
which means INCDIR will reflect changes to MACHINE. The := form sets INCDIR once and for all. What do you want? I can't see that this should be a problem in the arm makefile. Perhaps I'm missing something.
/Brian
Quoted 22 lines · Brian Murphy
Quoted 8 lines · Jun Sun
Is this allowed? Can't find any such usage in kernel other than the worrisome comment below:
arch/arm/Makefile:# Grr, ?= doesn't work as all the other assignment operators do. Make bug?
The arm code does this:
# Only set INCDIR if its not already defined above
# Grr, ?= doesn't work as all the other assignment operators do. Make bug? ifeq ($(origin INCDIR), undefined)
INCDIR := $(MACHINE)
endifwhere the make docs say:
INCDIR ?= $(MACHINE)
Quoted 8 lines
is the same as
ifeq ($(origin INCDIR), undefined)
INCDIR = $(MACHINE)
endifwhich means INCDIR will reflect changes to MACHINE. The := form sets INCDIR once and for all. What do you want?
':=' is fine, as long as "?=" is deemed appropriate for kernel and hackers.
Jun
Quoted 5 lines · Jun Sun
Anybody would object this? It allows one to override
CROSS_COMPILEfrom command line or top-levelMakefile.Jun
Silly question: why does this matter if CROSS_COMPILE is on the command line? Command line definitions override anything in the makefile. Is it falling off the command line in a recursive make?
Quoted 14 lines
diff -Nru linux/arch/mips/Makefile.orig linux/arch/mips/Makefile
arch/mips/Makefile renamed from arch/mips/Makefile.orig +3
-1@@ -23,7 +23,9 @@ endif ifdef CONFIG_CROSSCOMPILE -CROSS_COMPILE = $(tool-prefix) + ifndef CROSS_COMPILE + CROSS_COMPILE = $(tool-prefix) + endif endif #
Signature · 2 lines
Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer
Quoted 5 lines · Daniel Jacobowitz
Silly question: why does this matter if
CROSS_COMPILEis on the command line? Command line definitions override anything in the makefile. Is it falling off the command line in a recursive make?
You need ?= to allow the define in the top level makefile to override that in the sub-makefile. You also need it if you want to get the value from an environment variable and not from something like this:
make CROSS_COMPILE=xxx
which is the only case where it works now.
/Brian