diff options
author | Sam Ravnborg <sam@neptun.(none)> | 2007-10-15 16:17:25 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@neptun.(none)> | 2007-10-15 16:17:25 -0400 |
commit | 06c5040cdb13d27adad118f2fbfae905a1911b37 (patch) | |
tree | e5e62e04ca2d6f834aed9925a13869f730656139 | |
parent | 52bcc3308ae3344266f55bf98a22c1ac0201eda7 (diff) |
kbuild: enable 'make CPPFLAGS=...' to add additional options to CPP
The variable CPPFLAGS is a wellknown variable and the usage by
kbuild may result in unexpected behaviour.
This patch replace use of CPPFLAGS with KBUILD_CPPFLAGS all over the
tree and enabling one to use:
make CPPFLAGS=...
to specify additional CPP commandline options.
Patch was tested on following architectures:
alpha, arm, i386, x86_64, mips, sparc, sparc64, ia64, m68k, s390
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 2 | ||||
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | arch/arm/Makefile | 4 | ||||
-rw-r--r-- | arch/ia64/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/Makefile | 2 | ||||
-rw-r--r-- | arch/ppc/Makefile | 2 | ||||
-rw-r--r-- | arch/um/Makefile-x86_64 | 2 | ||||
-rw-r--r-- | drivers/atm/Makefile | 2 | ||||
-rw-r--r-- | scripts/Makefile.lib | 6 |
9 files changed, 18 insertions, 17 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index f4779cd1542f..08fbe6cd309d 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -1099,7 +1099,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1099 | specified options when building the target vmlinux.lds. | 1099 | specified options when building the target vmlinux.lds. |
1100 | 1100 | ||
1101 | When building the *.lds target, kbuild uses the variables: | 1101 | When building the *.lds target, kbuild uses the variables: |
1102 | CPPFLAGS : Set in top-level Makefile | 1102 | KBUILD_CPPFLAGS : Set in top-level Makefile |
1103 | EXTRA_CPPFLAGS : May be set in the kbuild makefile | 1103 | EXTRA_CPPFLAGS : May be set in the kbuild makefile |
1104 | CPPFLAGS_$(@F) : Target specific flags. | 1104 | CPPFLAGS_$(@F) : Target specific flags. |
1105 | Note that the full filename is used in this | 1105 | Note that the full filename is used in this |
@@ -318,7 +318,7 @@ LINUXINCLUDE := -Iinclude \ | |||
318 | $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ | 318 | $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ |
319 | -include include/linux/autoconf.h | 319 | -include include/linux/autoconf.h |
320 | 320 | ||
321 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | 321 | KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) |
322 | 322 | ||
323 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 323 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
324 | -fno-strict-aliasing -fno-common \ | 324 | -fno-strict-aliasing -fno-common \ |
@@ -334,7 +334,7 @@ export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC | |||
334 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE | 334 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE |
335 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 335 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
336 | 336 | ||
337 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | 337 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS |
338 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | 338 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE |
339 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE | 339 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE |
340 | 340 | ||
@@ -523,9 +523,10 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) | |||
523 | # disable pointer signed / unsigned warnings in gcc 4.0 | 523 | # disable pointer signed / unsigned warnings in gcc 4.0 |
524 | KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) | 524 | KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) |
525 | 525 | ||
526 | # Add user supplied AFLAGS and CFLAGS as the last assignments | 526 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments |
527 | KBUILD_AFLAGS += $(AFLAGS) | 527 | KBUILD_CPPFLAGS += $(CPPFLAGS) |
528 | KBUILD_CFLAGS += $(CFLAGS) | 528 | KBUILD_AFLAGS += $(AFLAGS) |
529 | KBUILD_CFLAGS += $(CFLAGS) | ||
529 | 530 | ||
530 | # Use --build-id when available. | 531 | # Use --build-id when available. |
531 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ | 532 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ |
@@ -1507,7 +1508,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) | |||
1507 | 1508 | ||
1508 | 1509 | ||
1509 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ | 1510 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ |
1510 | $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 1511 | $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |
1511 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) | 1512 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) |
1512 | 1513 | ||
1513 | quiet_cmd_as_o_S = AS $@ | 1514 | quiet_cmd_as_o_S = AS $@ |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index b762d235b81a..0d450e757e0e 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -32,11 +32,11 @@ KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog | |||
32 | endif | 32 | endif |
33 | 33 | ||
34 | ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) | 34 | ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) |
35 | CPPFLAGS += -mbig-endian | 35 | KBUILD_CPPFLAGS += -mbig-endian |
36 | AS += -EB | 36 | AS += -EB |
37 | LD += -EB | 37 | LD += -EB |
38 | else | 38 | else |
39 | CPPFLAGS += -mlittle-endian | 39 | KBUILD_CPPFLAGS += -mlittle-endian |
40 | AS += -EL | 40 | AS += -EL |
41 | LD += -EL | 41 | LD += -EL |
42 | endif | 42 | endif |
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 9708a29c70b5..34951aa2370b 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile | |||
@@ -29,7 +29,7 @@ cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ | |||
29 | CFLAGS_KERNEL := -mconstant-gp | 29 | CFLAGS_KERNEL := -mconstant-gp |
30 | 30 | ||
31 | GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") | 31 | GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") |
32 | CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") | 32 | KBUILD_CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") |
33 | 33 | ||
34 | ifeq ($(GAS_STATUS),buggy) | 34 | ifeq ($(GAS_STATUS),buggy) |
35 | $(error Sorry, you need a newer version of the assember, one that is built from \ | 35 | $(error Sorry, you need a newer version of the assember, one that is built from \ |
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 462bb89b67e8..4e165342210a 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile | |||
@@ -75,7 +75,7 @@ CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) | |||
75 | AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) | 75 | AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) |
76 | CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc | 76 | CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc |
77 | CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple | 77 | CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple |
78 | CPPFLAGS += $(CPPFLAGS-y) | 78 | KBUILD_CPPFLAGS += $(CPPFLAGS-y) |
79 | KBUILD_AFLAGS += $(AFLAGS-y) | 79 | KBUILD_AFLAGS += $(AFLAGS-y) |
80 | KBUILD_CFLAGS += -msoft-float -pipe $(CFLAGS-y) | 80 | KBUILD_CFLAGS += -msoft-float -pipe $(CFLAGS-y) |
81 | CPP = $(CC) -E $(KBUILD_CFLAGS) | 81 | CPP = $(CC) -E $(KBUILD_CFLAGS) |
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile index dd63ccb66732..95894ef7beaa 100644 --- a/arch/ppc/Makefile +++ b/arch/ppc/Makefile | |||
@@ -22,7 +22,7 @@ endif | |||
22 | 22 | ||
23 | LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic | 23 | LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic |
24 | # The -Iarch/$(ARCH)/include is temporary while we are merging | 24 | # The -Iarch/$(ARCH)/include is temporary while we are merging |
25 | CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include | 25 | KBUILD_CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include |
26 | KBUILD_AFLAGS += -Iarch/$(ARCH) | 26 | KBUILD_AFLAGS += -Iarch/$(ARCH) |
27 | KBUILD_CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ | 27 | KBUILD_CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ |
28 | -ffixed-r2 -mmultiple | 28 | -ffixed-r2 -mmultiple |
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64 index 8836f0df36aa..bcfd6ea30030 100644 --- a/arch/um/Makefile-x86_64 +++ b/arch/um/Makefile-x86_64 | |||
@@ -14,7 +14,7 @@ KBUILD_CFLAGS += $(_extra_flags_) | |||
14 | CHECKFLAGS += -m64 | 14 | CHECKFLAGS += -m64 |
15 | KBUILD_AFLAGS += -m64 | 15 | KBUILD_AFLAGS += -m64 |
16 | LDFLAGS += -m elf_x86_64 | 16 | LDFLAGS += -m elf_x86_64 |
17 | CPPFLAGS += -m64 | 17 | KBUILD_CPPFLAGS += -m64 |
18 | 18 | ||
19 | ELF_ARCH := i386:x86-64 | 19 | ELF_ARCH := i386:x86-64 |
20 | ELF_FORMAT := elf64-x86-64 | 20 | ELF_FORMAT := elf64-x86-64 |
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile index 1b16f8166b09..e4fa99658699 100644 --- a/drivers/atm/Makefile +++ b/drivers/atm/Makefile | |||
@@ -41,7 +41,7 @@ ifeq ($(CONFIG_ATM_FORE200E_PCA),y) | |||
41 | # guess the target endianess to choose the right PCA-200E firmware image | 41 | # guess the target endianess to choose the right PCA-200E firmware image |
42 | ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) | 42 | ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) |
43 | byteorder.h := include$(if $(patsubst $(srctree),,$(objtree)),2)/asm/byteorder.h | 43 | byteorder.h := include$(if $(patsubst $(srctree),,$(objtree)),2)/asm/byteorder.h |
44 | CONFIG_ATM_FORE200E_PCA_FW := $(obj)/pca200e$(if $(shell $(CC) $(CPPFLAGS) -E -dM $(byteorder.h) | grep ' __LITTLE_ENDIAN '),.bin,_ecd.bin2) | 44 | CONFIG_ATM_FORE200E_PCA_FW := $(obj)/pca200e$(if $(shell $(CC) $(KBUILD_CPPFLAGS) -E -dM $(byteorder.h) | grep ' __LITTLE_ENDIAN '),.bin,_ecd.bin2) |
45 | endif | 45 | endif |
46 | endif | 46 | endif |
47 | 47 | ||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 2837adaa9850..95e6e0fbdbd0 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -86,7 +86,7 @@ modname_flags = $(if $(filter 1,$(words $(modname))),\ | |||
86 | 86 | ||
87 | _c_flags = $(KBUILD_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) | 87 | _c_flags = $(KBUILD_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) |
88 | _a_flags = $(KBUILD_AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) | 88 | _a_flags = $(KBUILD_AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) |
89 | _cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) | 89 | _cpp_flags = $(KBUILD_CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) |
90 | 90 | ||
91 | # If building the kernel in a separate objtree expand all occurrences | 91 | # If building the kernel in a separate objtree expand all occurrences |
92 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). | 92 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). |
@@ -106,11 +106,11 @@ __a_flags = $(call flags,_a_flags) | |||
106 | __cpp_flags = $(call flags,_cpp_flags) | 106 | __cpp_flags = $(call flags,_cpp_flags) |
107 | endif | 107 | endif |
108 | 108 | ||
109 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 109 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |
110 | $(__c_flags) $(modkern_cflags) \ | 110 | $(__c_flags) $(modkern_cflags) \ |
111 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) | 111 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) |
112 | 112 | ||
113 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 113 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |
114 | $(__a_flags) $(modkern_aflags) | 114 | $(__a_flags) $(modkern_aflags) |
115 | 115 | ||
116 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) | 116 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) |