[kbuild-devel] [PATCH 2/4] kbuild: enable 'make AFLAGS=...' to add additional options to AS
The variable AFLAGS is a wellknown variable and the usage by kbuild may result in unexpected behaviour. On top of that several people over time has asked for a way to pass in additional flags to gcc. This patch replace use of AFLAGS with KBUILD_AFLAGS all over the tree and enabling one to use: make AFLAGS=... to specify additional gcc (as) commandline options. Signed-off-by: Sam Ravnborg [EMAIL PROTECTED] --- Documentation/kbuild/makefiles.txt |5 +++-- Makefile |9 + arch/arm/Makefile |2 +- arch/arm/vfp/Makefile |2 +- arch/avr32/Makefile|4 ++-- arch/blackfin/Makefile |2 +- arch/cris/Makefile |2 +- arch/frv/Makefile | 10 +- arch/h8300/Makefile|2 +- arch/h8300/lib/Makefile|2 +- arch/i386/Makefile |6 +++--- arch/i386/boot/Makefile|2 +- arch/m32r/Makefile |2 +- arch/m68knommu/Makefile|2 +- arch/m68knommu/platform/5206/Makefile |2 +- arch/m68knommu/platform/5206e/Makefile |2 +- arch/m68knommu/platform/520x/Makefile |2 +- arch/m68knommu/platform/523x/Makefile |2 +- arch/m68knommu/platform/5249/Makefile |2 +- arch/m68knommu/platform/5272/Makefile |2 +- arch/m68knommu/platform/527x/Makefile |2 +- arch/m68knommu/platform/528x/Makefile |2 +- arch/m68knommu/platform/5307/Makefile |2 +- arch/m68knommu/platform/532x/Makefile |2 +- arch/m68knommu/platform/5407/Makefile |2 +- arch/mips/Makefile |2 +- arch/powerpc/Makefile |4 ++-- arch/ppc/Makefile |4 ++-- arch/s390/Makefile |6 +++--- arch/sh/Makefile |2 +- arch/sparc/Makefile|2 +- arch/sparc64/Makefile |2 +- arch/um/Makefile |2 +- arch/um/Makefile-i386 |2 +- arch/um/Makefile-x86_64|2 +- arch/um/sys-ppc/Makefile |6 +++--- arch/x86_64/Makefile |6 +++--- arch/x86_64/boot/compressed/Makefile |2 +- arch/xtensa/boot/Makefile |2 +- scripts/Kbuild.include |2 +- scripts/Makefile.lib |2 +- 41 files changed, 62 insertions(+), 60 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 4df47e4..15b3c11 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -425,6 +425,7 @@ more details, with real examples. as-instr checks if the assembler reports a specific instruction and then outputs either option1 or option2 C escapes are supported in the test instruction + Note: as-instr-option uses KBUILD_AFLAGS for $(AS) options cc-option cc-option is used to check if $(CC) supports a given option, and not @@ -820,14 +821,14 @@ When kbuild executes, the following steps are followed (roughly): In this example, the binary $(obj)/image is a binary version of vmlinux. The usage of $(call if_changed,xxx) will be described later. -AFLAGS $(AS) assembler flags +KBUILD_AFLAGS $(AS) assembler flags Default value - see top level Makefile Append or modify as required per architecture. Example: #arch/sparc64/Makefile - AFLAGS += -m64 -mcpu=ultrasparc + KBUILD_AFLAGS += -m64 -mcpu=ultrasparc KBUILD_CFLAGS $(CC) compiler flags diff --git a/Makefile b/Makefile index 2a83bf3..5b2dbdd 100644 --- a/Makefile +++ b/Makefile @@ -315,7 +315,7 @@ CPPFLAGS:= -D__KERNEL__ $(LINUXINCLUDE) KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration -AFLAGS := -D__ASSEMBLY__ +KBUILD_AFLAGS := -D__ASSEMBLY__ # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2 /dev/null) @@ -328,7 +328,7 @@ export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE -export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE +export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE # When compiling out-of-tree modules, put MODVERDIR in the module # tree rather than in the kernel tree. The kernel tree might @@ -514,7 +514,8 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) # disable pointer signed / unsigned warnings in gcc 4.0 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) -#
[kbuild-devel] [PATCH 4/4] 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_AFLAGS all over the tree and enabling one to use: make CPPFLAGS=... to specify additional CPP commandline options. Signed-off-by: Sam Ravnborg [EMAIL PROTECTED] --- Documentation/kbuild/makefiles.txt |2 +- Makefile | 13 +++-- arch/arm/Makefile |4 ++-- arch/ia64/Makefile |2 +- arch/powerpc/Makefile |2 +- arch/ppc/Makefile |2 +- arch/um/Makefile-x86_64|2 +- drivers/atm/Makefile |2 +- scripts/Makefile.lib |6 +++--- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 15b3c11..29d070f 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -1100,7 +1100,7 @@ When kbuild executes, the following steps are followed (roughly): specified options when building the target vmlinux.lds. When building the *.lds target, kbuild uses the variables: - CPPFLAGS: Set in top-level Makefile + KBUILD_CPPFLAGS : Set in top-level Makefile EXTRA_CPPFLAGS : May be set in the kbuild makefile CPPFLAGS_$(@F) : Target specific flags. Note that the full filename is used in this diff --git a/Makefile b/Makefile index 5b2dbdd..771ecd8 100644 --- a/Makefile +++ b/Makefile @@ -310,7 +310,7 @@ LINUXINCLUDE:= -Iinclude \ $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ -include include/linux/autoconf.h -CPPFLAGS:= -D__KERNEL__ $(LINUXINCLUDE) +KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ @@ -326,7 +326,7 @@ export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS -export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS +export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE @@ -514,9 +514,10 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) # disable pointer signed / unsigned warnings in gcc 4.0 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) -# Add user supplied AFLAGS and CFLAGS as the last assignments -KBUILD_AFLAGS += $(AFLAGS) -KBUILD_CFLAGS += $(CFLAGS) +# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments +KBUILD_CPPFLAGS += $(CPPFLAGS) +KBUILD_AFLAGS += $(AFLAGS) +KBUILD_CFLAGS += $(CFLAGS) # Use --build-id when available. LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ @@ -1492,7 +1493,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ - $(NOSTDINC_FLAGS) $(CPPFLAGS) \ + $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) quiet_cmd_as_o_S = AS $@ diff --git a/arch/arm/Makefile b/arch/arm/Makefile index e7eab5b..b315899 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -32,11 +32,11 @@ KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog endif ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) -CPPFLAGS += -mbig-endian +KBUILD_CPPFLAGS+= -mbig-endian AS += -EB LD += -EB else -CPPFLAGS += -mlittle-endian +KBUILD_CPPFLAGS+= -mlittle-endian AS += -EL LD += -EL endif diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 9708a29..34951aa 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 \ CFLAGS_KERNEL := -mconstant-gp GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas $(CC) $(OBJDUMP)) -CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP) $(READELF)) +KBUILD_CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP) $(READELF)) ifeq ($(GAS_STATUS),buggy) $(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 02fbeb1..8138ac2 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -68,7 +68,7 @@ CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2
[kbuild-devel] moving to vger (Re: CPP includes ([PATCH 3/4] ia64: fix sn to add include files using EXTRA_CFLAGS))
On Mon, Sep 10, 2007 at 12:45:52AM +0200, Oleg Verych wrote: [] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ kbuild-devel mailing list kbuild-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kbuild-devel How about that? Kernel Janitors moved recently thankfully to David Miller. Footer, that i don't think is usefull anyway, will be 2 times shorter, non changed subject will be shorter too :) This list is very low traffic, so may be it'll be OK... Thanks. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ kbuild-devel mailing list kbuild-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kbuild-devel