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 <kumar.gala@linaro.org>
This commit is contained in:
parent
7753e335f7
commit
6102427e5d
17 changed files with 48 additions and 78 deletions
|
@ -7,3 +7,9 @@ include $(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/Makefile
|
||||||
KBUILD_CFLAGS += $(cflags-y)
|
KBUILD_CFLAGS += $(cflags-y)
|
||||||
KBUILD_CXXFLAGS += $(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)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
|
soc-cflags = $(call cc-option,-mARCv2EM) \
|
||||||
arch-cflags = $(call cc-option,-mARCv2EM) \
|
|
||||||
$(call cc-option,-mav2em,) $(call cc-option,-mno-sdata)
|
$(call cc-option,-mav2em,) $(call cc-option,-mno-sdata)
|
||||||
|
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
|
soc-cflags = $(call cc-option,-mARCv2EM) \
|
||||||
arch-cflags = $(call cc-option,-mARCv2EM) \
|
|
||||||
$(call cc-option,-mav2em,) $(call cc-option,-mno-sdata)
|
$(call cc-option,-mav2em,) $(call cc-option,-mno-sdata)
|
||||||
|
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
|
soc-cflags = $(call cc-option,-mARCv2EM) \
|
||||||
arch-cflags = $(call cc-option,-mARCv2EM) \
|
|
||||||
$(call cc-option,-mav2em,) $(call cc-option,-mno-sdata)
|
$(call cc-option,-mav2em,) $(call cc-option,-mno-sdata)
|
||||||
|
soc-aflags = $(soc-cflags)
|
||||||
KBUILD_CFLAGS += -DQM_SENSOR=1
|
soc-cxxflags = $(soc-cflags)
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
soc-cflags += -DQM_SENSOR=1
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -7,6 +7,12 @@ cflags-$(CONFIG_LTO) += $(call cc-option,-flto,)
|
||||||
KBUILD_CFLAGS += $(cflags-y)
|
KBUILD_CFLAGS += $(cflags-y)
|
||||||
KBUILD_CXXFLAGS += $(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_CPU_TYPE_arm = cortex-m3
|
||||||
QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \
|
QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \
|
||||||
-machine lm3s6965evb -nographic -vga none
|
-machine lm3s6965evb -nographic -vga none
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
|
soc-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \
|
||||||
arch-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \
|
|
||||||
$(call cc-option,-mthumb -march=armv7-m)
|
$(call cc-option,-mthumb -march=armv7-m)
|
||||||
|
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -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,-march=armv7e-m) \
|
||||||
$(call cc-option,-mabi=aapcs) \
|
$(call cc-option,-mabi=aapcs)
|
||||||
|
|
||||||
_CROSS_COMPILE_arm_isa = armv7e-m
|
_CROSS_COMPILE_arm_isa = armv7e-m
|
||||||
export _CROSS_COMPILE_arm_isa
|
export _CROSS_COMPILE_arm_isa
|
||||||
|
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -1,8 +1,2 @@
|
||||||
|
soc-cflags = $(call cc-option,-mthumb -mcpu=cortex-m4) \
|
||||||
|
|
||||||
arch-cflags = $(call cc-option,-mthumb -mcpu=cortex-m4) \
|
|
||||||
$(call cc-option,-mthumb -march=armv7e-m)
|
$(call cc-option,-mthumb -march=armv7e-m)
|
||||||
|
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
|
soc-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \
|
||||||
arch-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \
|
|
||||||
$(call cc-option,-mthumb -march=armv7-m)
|
$(call cc-option,-mthumb -march=armv7-m)
|
||||||
|
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
|
soc-cflags = $(call cc-option,-mthumb -mcpu=cortex-m3) \
|
||||||
arch-cflags = $(call cc-option,-mthumb -mcpu=cortex-m3) \
|
|
||||||
$(call cc-option,-mthumb -march=armv7-m)
|
$(call cc-option,-mthumb -march=armv7-m)
|
||||||
|
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_AFLAGS += $(arch-cflags)
|
|
||||||
|
|
|
@ -21,3 +21,9 @@ arch_cflags += $(call cc-option,-I$(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/includ
|
||||||
KBUILD_AFLAGS += $(arch_cflags)
|
KBUILD_AFLAGS += $(arch_cflags)
|
||||||
KBUILD_CFLAGS += $(arch_cflags)
|
KBUILD_CFLAGS += $(arch_cflags)
|
||||||
KBUILD_CXXFLAGS += $(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)
|
||||||
|
|
|
@ -34,6 +34,12 @@ include $(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/Makefile
|
||||||
KBUILD_CXXFLAGS += $(cflags-y)
|
KBUILD_CXXFLAGS += $(cflags-y)
|
||||||
KBUILD_CFLAGS += $(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_BIOS ?= /usr/share/qemu
|
||||||
QEMU_CPU_TYPE_x86 = qemu32
|
QEMU_CPU_TYPE_x86 = qemu32
|
||||||
QEMU_X86_NO_REBOOT_y =
|
QEMU_X86_NO_REBOOT_y =
|
||||||
|
|
|
@ -1,6 +1 @@
|
||||||
|
soc-cflags = -march=atom $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
|
||||||
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)
|
|
||||||
|
|
|
@ -2,9 +2,7 @@ ifeq ($(CONFIG_X86_IAMCU),y)
|
||||||
LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU
|
LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU
|
||||||
OUTPUT_FORMAT = elf32-iamcu
|
OUTPUT_FORMAT = elf32-iamcu
|
||||||
OUTPUT_ARCH = iamcu:intel
|
OUTPUT_ARCH = iamcu:intel
|
||||||
KBUILD_CFLAGS += $(call cc-option,-msoft-float)
|
soc-cflags = $(call cc-option,-msoft-float)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
KBUILD_CFLAGS += $(call cc-option,-march=pentium)
|
soc-cflags += $(call cc-option,-march=pentium)
|
||||||
KBUILD_CXXFLAGS += $(call cc-option,-march=pentium)
|
|
||||||
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
|
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
ifeq ($(COMPILER),clang)
|
ifeq ($(COMPILER),clang)
|
||||||
arch-cflags = $(call cc-option,-msoft-float, -march=pentium)
|
soc-cflags = $(call cc-option,-msoft-float, -march=pentium)
|
||||||
else
|
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
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_X86_IAMCU),y)
|
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
|
LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU
|
||||||
OUTPUT_FORMAT = elf32-iamcu
|
OUTPUT_FORMAT = elf32-iamcu
|
||||||
OUTPUT_ARCH = iamcu:intel
|
OUTPUT_ARCH = iamcu:intel
|
||||||
else
|
else
|
||||||
arch-cflags += $(call cc-option,-mno-iamcu)
|
soc-cflags += $(call cc-option,-mno-iamcu)
|
||||||
endif
|
endif
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
|
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
ifeq ($(COMPILER),clang)
|
ifeq ($(COMPILER),clang)
|
||||||
arch-cflags = $(call cc-option,-msoft-float, -march=pentium)
|
soc-cflags = $(call cc-option,-msoft-float, -march=pentium)
|
||||||
else
|
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
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_X86_IAMCU),y)
|
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
|
LD_TOOLCHAIN ?= -D__GCC_LINKER_CMD__ -D__IAMCU
|
||||||
OUTPUT_FORMAT = elf32-iamcu
|
OUTPUT_FORMAT = elf32-iamcu
|
||||||
OUTPUT_ARCH = iamcu:intel
|
OUTPUT_ARCH = iamcu:intel
|
||||||
else
|
else
|
||||||
arch-cflags += $(call cc-option,-mno-iamcu)
|
soc-cflags += $(call cc-option,-mno-iamcu)
|
||||||
endif
|
endif
|
||||||
KBUILD_CFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_CXXFLAGS += $(arch-cflags)
|
|
||||||
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
|
|
||||||
|
|
|
@ -1,4 +1 @@
|
||||||
|
soc-cflags = $(call cc-option,-march=pentium)
|
||||||
KBUILD_CFLAGS += $(call cc-option,-march=pentium)
|
|
||||||
KBUILD_CXXFLAGS += $(call cc-option,-march=pentium)
|
|
||||||
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue