summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--Makefile.inc24
-rw-r--r--src/arch/arm/armv4/Makefile.inc12
-rw-r--r--src/arch/arm/armv7/Makefile.inc12
-rw-r--r--toolchain.inc4
5 files changed, 33 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index fa421016926c..eaac22bb901d 100644
--- a/Makefile
+++ b/Makefile
@@ -219,12 +219,13 @@ alldirs:=$(sort $(abspath $(dir $(allobjs))))
define create_cc_template
# $1 obj class
# $2 source suffix (c, S)
-# $3 additional dependencies
+# $3 additional compiler flags
+# $4 additional dependencies
ifn$(EMPTY)def $(1)-objs_$(2)_template
de$(EMPTY)fine $(1)-objs_$(2)_template
-$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(3)
+$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4)
@printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
- $(CC_$(1)) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -c -o $$$$@ $$$$<
+ $(CC_$(1)) $(3) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -c -o $$$$@ $$$$<
en$(EMPTY)def
end$(EMPTY)if
endef
@@ -232,7 +233,7 @@ endef
filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs))))
$(foreach class,$(classes), \
$(foreach type,$(call filetypes-of-class,$(class)), \
- $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-deps)))))
+ $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps)))))
foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file))))))
$(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
diff --git a/Makefile.inc b/Makefile.inc
index 934755fd6887..1aa4ddefdadc 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -115,12 +115,13 @@ ramstage-postprocess=$(foreach d,$(sort $(dir $(1))), \
$(eval $(d)ramstage.o: $(call files-in-dir,$(d),$(1)); $$(LD_ramstage) -o $$@ -r $$^ ) \
$(eval ramstage-objs:=$(d)ramstage.o $(filter-out $(call files-in-dir,$(d),$(1)),$(ramstage-objs))))
-CPPFLAGS_romstage += -D__PRE_RAM__
+romstage-c-ccopts:=-D__PRE_RAM__
+romstage-S-ccopts:=-D__PRE_RAM__
ifeq ($(CONFIG_TRACE),y)
-CFLAGS_ramstage += -finstrument-functions
+ramstage-c-ccopts:= -finstrument-functions
endif
ifeq ($(CONFIG_COVERAGE),y)
-CFLAGS_ramstage += -fprofile-arcs -ftest-coverage
+ramstage-c-ccopts+=-fprofile-arcs -ftest-coverage
endif
# try to fetch non-optional submodules
@@ -131,15 +132,18 @@ ifeq ($(CONFIG_USE_BLOBS),y)
forgetthis:=$(shell git submodule update --init --checkout 3rdparty)
endif
-CPPFLAGS_bootblock += -D__BOOT_BLOCK__ -D__PRE_RAM__
+bootblock-c-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
+bootblock-S-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
-CPPFLAGS_smmstub += -D__SMM__
-CPPFLAGS_smm += -D__SMM__
+smmstub-c-ccopts:=-D__SMM__
+smmstub-S-ccopts:=-D__SMM__
+smm-c-ccopts:=-D__SMM__
+smm-S-ccopts:=-D__SMM__
# SMM TSEG base is dynamic
ifneq ($(CONFIG_SMM_MODULES),y)
ifeq ($(CONFIG_SMM_TSEG),y)
-CFLAGS_smm += -fpic
+smm-c-ccopts += -fpic
endif
endif
@@ -337,15 +341,15 @@ $(objutil)/%.o: $(objutil)/%.c
$(obj)/%.ramstage.o $(abspath $(obj))/%.ramstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_ramstage) -MMD $(CFLAGS_ramstage) $(CPPFLAGS_ramstage) -c -o $@ $<
+ $(CC_ramstage) -MMD $(CFLAGS_ramstage) $(CPPFLAGS_ramstage) $(ramstage-c-ccopts) -c -o $@ $<
$(obj)/%.romstage.o $(abspath $(obj))/%.romstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_romstage) -MMD -D__PRE_RAM__ $(CFLAGS_romstage) $(CPPFLAGS_romstage) -c -o $@ $<
+ $(CC_romstage) -MMD $(CFLAGS_romstage) $(CPPFLAGS_romstage) $(romstage-c-ccopts) -c -o $@ $<
$(obj)/%.bootblock.o $(abspath $(obj))/%.bootblock.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_bootblock) -MMD $(CFLAGS_bootblock) $(CPPFLAGS_bootblock) -c -o $@ $<
+ $(CC_bootblock) -MMD $(CFLAGS_bootblock) $(CPPFLAGS_bootblock) $(bootblock-c-ccopts) -c -o $@ $<
#######################################################################
# Clean up rules
diff --git a/src/arch/arm/armv4/Makefile.inc b/src/arch/arm/armv4/Makefile.inc
index aa788688d033..6b516b9cf9cc 100644
--- a/src/arch/arm/armv4/Makefile.inc
+++ b/src/arch/arm/armv4/Makefile.inc
@@ -35,8 +35,8 @@ endif
bootblock-y += cache.c
-CFLAGS_bootblock += $(armv4_flags)
-CPPFLAGS_bootblock += $(armv4_flags)
+bootblock-c-ccopts += $(armv4_flags)
+bootblock-S-ccopts += $(armv4_flags)
endif # CONFIG_ARCH_BOOTBLOCK_ARMV4
@@ -47,8 +47,8 @@ endif # CONFIG_ARCH_BOOTBLOCK_ARMV4
ifeq ($(CONFIG_ARCH_ROMSTAGE_ARMV4),y)
-CFLAGS_romstage += $(armv4_flags)
-CPPFLAGS_romstage += $(armv4_flags)
+romstage-c-ccopts += $(armv4_flags)
+romstage-S-ccopts += $(armv4_flags)
endif # CONFIG_ARCH_ROMSTAGE_ARMV4
@@ -58,7 +58,7 @@ endif # CONFIG_ARCH_ROMSTAGE_ARMV4
ifeq ($(CONFIG_ARCH_RAMSTAGE_ARMV4),y)
-CFLAGS_ramstage += $(armv4_flags)
-CPPFLAGS_ramstage += $(armv4_flags)
+ramstage-c-ccopts += $(armv4_flags)
+ramstage-S-ccopts += $(armv4_flags)
endif # CONFIG_ARCH_RAMSTAGE_ARMV4
diff --git a/src/arch/arm/armv7/Makefile.inc b/src/arch/arm/armv7/Makefile.inc
index c46fb39c5ef4..4f3e75789c72 100644
--- a/src/arch/arm/armv7/Makefile.inc
+++ b/src/arch/arm/armv7/Makefile.inc
@@ -39,8 +39,8 @@ bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += exception.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += exception_asm.S
bootblock-y += mmu.c
-CFLAGS_bootblock += $(armv7_flags)
-CPPFLAGS_bootblock += $(armv7_flags)
+bootblock-c-ccopts += $(armv7_flags)
+bootblock-S-ccopts += $(armv7_flags)
endif # CONFIG_ARCH_BOOTBLOCK_ARMV7
@@ -56,8 +56,8 @@ romstage-y += exception.c
romstage-y += exception_asm.S
romstage-y += mmu.c
-CFLAGS_romstage += $(armv7_flags)
-CPPFLAGS_romstage += $(armv7_flags)
+romstage-c-ccopts += $(armv7_flags)
+romstage-S-ccopts += $(armv7_flags)
endif # CONFIG_ARCH_ROMSTAGE_ARMV7
@@ -73,7 +73,7 @@ ramstage-y += exception.c
ramstage-y += exception_asm.S
ramstage-y += mmu.c
-CFLAGS_ramstage += $(armv7_flags)
-CPPFLAGS_ramstage += $(armv7_flags)
+ramstage-c-ccopts += $(armv7_flags)
+ramstage-S-ccopts += $(armv7_flags)
endif # CONFIG_ARCH_RAMSTAGE_ARMV7
diff --git a/toolchain.inc b/toolchain.inc
index 1f95b6b2d825..0ed370f49ae3 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -90,8 +90,8 @@ OBJCOPY_$(1) := $(OBJCOPY_$(2))
OBJDUMP_$(1) := $(OBJDUMP_$(2))
STRIP_$(1) := $(STRIP_$(2))
READELF_$(1) := $(READELF_$(2))
-CFLAGS_$(1) += $$(CFLAGS_common) $$(CFLAGS_$(2))
-CPPFLAGS_$(1) += $$(CPPFLAGS_common) $$(CPPFLAGS_$(2))
+CFLAGS_$(1) = $$(CFLAGS_common) $$(CFLAGS_$(2))
+CPPFLAGS_$(1) = $$(CPPFLAGS_common) $$(CPPFLAGS_$(2))
LIBGCC_FILE_NAME_$(1) = $(wildcard $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-libgcc-file-name))
LIBCLANG_RT_FILE_NAME_$(1) = $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-librt-file-name 2>/dev/null)
endef