From 6102427e5d52f6ed75797be007c508b54a5feeb1 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 26 May 2016 10:32:04 -0500 Subject: [PATCH] build: Introduce concept of SoC specific build flags Introduce a soc-cflags, soc-cxxflags, and soc-aflags as a means for SoC specific compiler flags to be set without manipulating Kbuild options directly. Change-Id: I2c8f5019fb237429e59717ef96bd4251a61dc1a5 Signed-off-by: Kumar Gala --- arch/arc/Makefile | 6 ++++++ arch/arc/soc/em11d/Makefile | 7 +------ arch/arc/soc/em9d/Makefile | 7 +------ arch/arc/soc/quark_se_ss/Makefile | 11 ++++------- arch/arm/Makefile | 6 ++++++ arch/arm/soc/atmel_sam3/Makefile | 7 +------ arch/arm/soc/nordic_nrf5/nrf52/Makefile | 8 ++------ arch/arm/soc/nxp_kinetis/k6x/Makefile | 8 +------- arch/arm/soc/st_stm32/stm32f1/Makefile | 7 +------ arch/arm/soc/ti_lm3s6965/Makefile | 7 +------ arch/nios2/Makefile | 6 ++++++ arch/x86/Makefile | 6 ++++++ arch/x86/soc/atom/Makefile | 7 +------ arch/x86/soc/ia32/Makefile | 6 ++---- arch/x86/soc/quark_d2000/Makefile | 11 ++++------- arch/x86/soc/quark_se/Makefile | 11 ++++------- arch/x86/soc/quark_x1000/Makefile | 5 +---- 17 files changed, 48 insertions(+), 78 deletions(-) diff --git a/arch/arc/Makefile b/arch/arc/Makefile index 42caa6d545e..1441b297303 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile @@ -7,3 +7,9 @@ include $(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/Makefile KBUILD_CFLAGS += $(cflags-y) KBUILD_CXXFLAGS += $(cflags-y) +soc-cxxflags ?= $(soc-cflags) +soc-aflags ?= $(soc-cflags) +KBUILD_CFLAGS += $(soc-cflags) +KBUILD_CXXFLAGS += $(soc-cxxflags) +KBUILD_AFLAGS += $(soc-aflags) + diff --git a/arch/arc/soc/em11d/Makefile b/arch/arc/soc/em11d/Makefile index ee18aeb466b..503b9e0f94f 100644 --- a/arch/arc/soc/em11d/Makefile +++ b/arch/arc/soc/em11d/Makefile @@ -1,7 +1,2 @@ - -arch-cflags = $(call cc-option,-mARCv2EM) \ +soc-cflags = $(call cc-option,-mARCv2EM) \ $(call cc-option,-mav2em,) $(call cc-option,-mno-sdata) - -KBUILD_AFLAGS += $(arch-cflags) -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) diff --git a/arch/arc/soc/em9d/Makefile b/arch/arc/soc/em9d/Makefile index ee18aeb466b..503b9e0f94f 100644 --- a/arch/arc/soc/em9d/Makefile +++ b/arch/arc/soc/em9d/Makefile @@ -1,7 +1,2 @@ - -arch-cflags = $(call cc-option,-mARCv2EM) \ +soc-cflags = $(call cc-option,-mARCv2EM) \ $(call cc-option,-mav2em,) $(call cc-option,-mno-sdata) - -KBUILD_AFLAGS += $(arch-cflags) -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) diff --git a/arch/arc/soc/quark_se_ss/Makefile b/arch/arc/soc/quark_se_ss/Makefile index fa24aa271cd..aa7d1619db1 100644 --- a/arch/arc/soc/quark_se_ss/Makefile +++ b/arch/arc/soc/quark_se_ss/Makefile @@ -1,8 +1,5 @@ - -arch-cflags = $(call cc-option,-mARCv2EM) \ +soc-cflags = $(call cc-option,-mARCv2EM) \ $(call cc-option,-mav2em,) $(call cc-option,-mno-sdata) - -KBUILD_CFLAGS += -DQM_SENSOR=1 -KBUILD_AFLAGS += $(arch-cflags) -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) +soc-aflags = $(soc-cflags) +soc-cxxflags = $(soc-cflags) +soc-cflags += -DQM_SENSOR=1 diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 6fb1053b5ea..ed68bc84305 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -7,6 +7,12 @@ cflags-$(CONFIG_LTO) += $(call cc-option,-flto,) KBUILD_CFLAGS += $(cflags-y) KBUILD_CXXFLAGS += $(cflags-y) +soc-cxxflags ?= $(soc-cflags) +soc-aflags ?= $(soc-cflags) +KBUILD_CFLAGS += $(soc-cflags) +KBUILD_CXXFLAGS += $(soc-cxxflags) +KBUILD_AFLAGS += $(soc-aflags) + QEMU_CPU_TYPE_arm = cortex-m3 QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \ -machine lm3s6965evb -nographic -vga none diff --git a/arch/arm/soc/atmel_sam3/Makefile b/arch/arm/soc/atmel_sam3/Makefile index e7d49489052..fec6fe38f1c 100644 --- a/arch/arm/soc/atmel_sam3/Makefile +++ b/arch/arm/soc/atmel_sam3/Makefile @@ -1,7 +1,2 @@ - -arch-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \ +soc-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \ $(call cc-option,-mthumb -march=armv7-m) - -KBUILD_AFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_CFLAGS += $(arch-cflags) diff --git a/arch/arm/soc/nordic_nrf5/nrf52/Makefile b/arch/arm/soc/nordic_nrf5/nrf52/Makefile index 4f8b34a4c18..0e8ad8efd53 100644 --- a/arch/arm/soc/nordic_nrf5/nrf52/Makefile +++ b/arch/arm/soc/nordic_nrf5/nrf52/Makefile @@ -1,10 +1,6 @@ -arch-cflags += $(call cc-option,-mthumb -mcpu=cortex-m4) \ +soc-cflags = $(call cc-option,-mthumb -mcpu=cortex-m4) \ $(call cc-option,-march=armv7e-m) \ - $(call cc-option,-mabi=aapcs) \ + $(call cc-option,-mabi=aapcs) _CROSS_COMPILE_arm_isa = armv7e-m export _CROSS_COMPILE_arm_isa - -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_AFLAGS += $(arch-cflags) diff --git a/arch/arm/soc/nxp_kinetis/k6x/Makefile b/arch/arm/soc/nxp_kinetis/k6x/Makefile index 5ebdf2eba72..4e2f413698b 100644 --- a/arch/arm/soc/nxp_kinetis/k6x/Makefile +++ b/arch/arm/soc/nxp_kinetis/k6x/Makefile @@ -1,8 +1,2 @@ - - -arch-cflags = $(call cc-option,-mthumb -mcpu=cortex-m4) \ +soc-cflags = $(call cc-option,-mthumb -mcpu=cortex-m4) \ $(call cc-option,-mthumb -march=armv7e-m) - -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_AFLAGS += $(arch-cflags) diff --git a/arch/arm/soc/st_stm32/stm32f1/Makefile b/arch/arm/soc/st_stm32/stm32f1/Makefile index e7d49489052..fec6fe38f1c 100644 --- a/arch/arm/soc/st_stm32/stm32f1/Makefile +++ b/arch/arm/soc/st_stm32/stm32f1/Makefile @@ -1,7 +1,2 @@ - -arch-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \ +soc-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \ $(call cc-option,-mthumb -march=armv7-m) - -KBUILD_AFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_CFLAGS += $(arch-cflags) diff --git a/arch/arm/soc/ti_lm3s6965/Makefile b/arch/arm/soc/ti_lm3s6965/Makefile index 670a9815b22..3fae5fc3cc1 100644 --- a/arch/arm/soc/ti_lm3s6965/Makefile +++ b/arch/arm/soc/ti_lm3s6965/Makefile @@ -1,7 +1,2 @@ - -arch-cflags = $(call cc-option,-mthumb -mcpu=cortex-m3) \ +soc-cflags = $(call cc-option,-mthumb -mcpu=cortex-m3) \ $(call cc-option,-mthumb -march=armv7-m) - -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_AFLAGS += $(arch-cflags) diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile index fe2f1ad89fe..5c467601ac8 100644 --- a/arch/nios2/Makefile +++ b/arch/nios2/Makefile @@ -21,3 +21,9 @@ arch_cflags += $(call cc-option,-I$(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/includ KBUILD_AFLAGS += $(arch_cflags) KBUILD_CFLAGS += $(arch_cflags) KBUILD_CXXFLAGS += $(arch_cflags) + +soc-cxxflags ?= $(soc-cflags) +soc-aflags ?= $(soc-cflags) +KBUILD_CFLAGS += $(soc-cflags) +KBUILD_CXXFLAGS += $(soc-cxxflags) +KBUILD_AFLAGS += $(soc-aflags) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 2597cb22664..052f68de6ba 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -34,6 +34,12 @@ include $(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/Makefile KBUILD_CXXFLAGS += $(cflags-y) KBUILD_CFLAGS += $(cflags-y) +soc-cxxflags ?= $(soc-cflags) +soc-aflags ?= $(soc-cflags) +KBUILD_CFLAGS += $(soc-cflags) +KBUILD_CXXFLAGS += $(soc-cxxflags) +KBUILD_AFLAGS += $(soc-aflags) + QEMU_BIOS ?= /usr/share/qemu QEMU_CPU_TYPE_x86 = qemu32 QEMU_X86_NO_REBOOT_y = diff --git a/arch/x86/soc/atom/Makefile b/arch/x86/soc/atom/Makefile index ef5df42d1e7..6813ef4e1bc 100644 --- a/arch/x86/soc/atom/Makefile +++ b/arch/x86/soc/atom/Makefile @@ -1,6 +1 @@ - -arch-cflags = -march=atom $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) - -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_AFLAGS += $(KBUILD_CFLAGS) +soc-cflags = -march=atom $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) diff --git a/arch/x86/soc/ia32/Makefile b/arch/x86/soc/ia32/Makefile index 4b844357770..6933593580a 100644 --- a/arch/x86/soc/ia32/Makefile +++ b/arch/x86/soc/ia32/Makefile @@ -2,9 +2,7 @@ ifeq ($(CONFIG_X86_IAMCU),y) LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU OUTPUT_FORMAT = elf32-iamcu OUTPUT_ARCH = iamcu:intel -KBUILD_CFLAGS += $(call cc-option,-msoft-float) +soc-cflags = $(call cc-option,-msoft-float) endif -KBUILD_CFLAGS += $(call cc-option,-march=pentium) -KBUILD_CXXFLAGS += $(call cc-option,-march=pentium) -KBUILD_AFLAGS += $(KBUILD_CFLAGS) +soc-cflags += $(call cc-option,-march=pentium) diff --git a/arch/x86/soc/quark_d2000/Makefile b/arch/x86/soc/quark_d2000/Makefile index 14cc22cbf9a..9d376e729dd 100644 --- a/arch/x86/soc/quark_d2000/Makefile +++ b/arch/x86/soc/quark_d2000/Makefile @@ -1,17 +1,14 @@ ifeq ($(COMPILER),clang) -arch-cflags = $(call cc-option,-msoft-float, -march=pentium) +soc-cflags = $(call cc-option,-msoft-float, -march=pentium) else -arch-cflags = $(call cc-option,-march=lakemont -mtune=lakemont -msoft-float, -march=pentium) +soc-cflags = $(call cc-option,-march=lakemont -mtune=lakemont -msoft-float, -march=pentium) endif ifeq ($(CONFIG_X86_IAMCU),y) -arch-cflags += $(call cc-option,-miamcu) +soc-cflags += $(call cc-option,-miamcu) LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU OUTPUT_FORMAT = elf32-iamcu OUTPUT_ARCH = iamcu:intel else -arch-cflags += $(call cc-option,-mno-iamcu) +soc-cflags += $(call cc-option,-mno-iamcu) endif -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/soc/quark_se/Makefile b/arch/x86/soc/quark_se/Makefile index 14cc22cbf9a..9d376e729dd 100644 --- a/arch/x86/soc/quark_se/Makefile +++ b/arch/x86/soc/quark_se/Makefile @@ -1,17 +1,14 @@ ifeq ($(COMPILER),clang) -arch-cflags = $(call cc-option,-msoft-float, -march=pentium) +soc-cflags = $(call cc-option,-msoft-float, -march=pentium) else -arch-cflags = $(call cc-option,-march=lakemont -mtune=lakemont -msoft-float, -march=pentium) +soc-cflags = $(call cc-option,-march=lakemont -mtune=lakemont -msoft-float, -march=pentium) endif ifeq ($(CONFIG_X86_IAMCU),y) -arch-cflags += $(call cc-option,-miamcu) +soc-cflags += $(call cc-option,-miamcu) LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU OUTPUT_FORMAT = elf32-iamcu OUTPUT_ARCH = iamcu:intel else -arch-cflags += $(call cc-option,-mno-iamcu) +soc-cflags += $(call cc-option,-mno-iamcu) endif -KBUILD_CFLAGS += $(arch-cflags) -KBUILD_CXXFLAGS += $(arch-cflags) -KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/soc/quark_x1000/Makefile b/arch/x86/soc/quark_x1000/Makefile index 0b23a2dd91d..49ad83f91fd 100644 --- a/arch/x86/soc/quark_x1000/Makefile +++ b/arch/x86/soc/quark_x1000/Makefile @@ -1,4 +1 @@ - -KBUILD_CFLAGS += $(call cc-option,-march=pentium) -KBUILD_CXXFLAGS += $(call cc-option,-march=pentium) -KBUILD_AFLAGS += $(KBUILD_CFLAGS) +soc-cflags = $(call cc-option,-march=pentium)