build: Add ccopts back into the build

The ccopts mechanism is needed for passing ARM assembler flags to GCC.
There are many gotchas in adding ASFLAGS. As things have moved
around, the revert doesn't remove cleanly, so this reverts and cleans
up the ccopts.

This reverts commit 25b56c3af5.

Change-Id: I44c025535258e6afb05a814123c10c24775a88e8
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Reviewed-on: http://review.coreboot.org/7352
Tested-by: build bot (Jenkins)
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Marc Jones 2014-11-06 15:50:22 -07:00
parent 430363ace7
commit a38ccfdee1
5 changed files with 33 additions and 28 deletions

View File

@ -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))))

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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