[coreboot-gerrit] Patch set updated for coreboot: c4c4ade build system: extend src-to-obj for non-.c/.S files

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Apr 2 18:34:04 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9175

-gerrit

commit c4c4adeff689f25e87f0d3b74eb5b9a8b359f2aa
Author: Patrick Georgi <pgeorgi at chromium.org>
Date:   Fri Mar 27 17:03:28 2015 +0100

    build system: extend src-to-obj for non-.c/.S files
    
    It also creates file names in the build directory and with
    the stage sliced in, but keeps the extension for anything
    not .c or .S.
    
    Also some handling for non-.c/.S files was adapted to match.
    
    This is inspired by the commit listed below, but rewritten to match
    upstream, and split in smaller pieces to keep intent clear.
    
    Change-Id: If8f89a7daffcf51f430b64c3293d2a817ae5120f
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Based-On-Change-Id: I50af7dacf616e0f8ff4c43f4acc679089ad7022b
    Based-On-Signed-off-by: Julius Werner <jwerner at chromium.org>
    Based-On-Reviewed-on: https://chromium-review.googlesource.com/219170
---
 Makefile                                 | 9 +++++++--
 Makefile.inc                             | 2 +-
 src/arch/arm64/armv8/secmon/Makefile.inc | 2 +-
 src/arch/x86/Makefile.inc                | 6 +++---
 src/cpu/x86/Makefile.inc                 | 2 +-
 src/cpu/x86/smm/Makefile.inc             | 6 +++---
 6 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index c5cbda1..03811c6 100644
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,12 @@ endif
 # Eliminate duplicate mentions of source files in a class
 $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
 
-src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $(2))))
+# Converts one or more source file paths to their corresponding build/ paths.
+# Only .c and .S get converted to .o, other files (like .ld) keep their name.
+# $1 stage name
+# $2 file path (list)
+src-to-obj=$(foreach file,$(2),$(basename $(patsubst src/%,$(obj)/%,$(file))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file)))))
+
 $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs))))
 
 # Save all objs before processing them (for dependency inclusion)
@@ -241,7 +246,7 @@ $(foreach class,$(classes), \
 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))))
 
-DEPENDENCIES = $(originalobjs:.o=.d)
+DEPENDENCIES = $(addsuffix .d,$(basename $(allobjs)))
 -include $(DEPENDENCIES)
 
 printall:
diff --git a/Makefile.inc b/Makefile.inc
index 81b4c2b..1a5b616 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -142,7 +142,7 @@ bootblock-c-deps:=$$(OPTION_TABLE_H)
 #######################################################################
 # Add handler to compile ACPI's ASL
 define ramstage-objs_asl_template
-$(obj)/$(1).ramstage.o: src/$(1).asl $(obj)/config.h
+$(obj)/$(1).ramstage.asl: src/$(1).asl $(obj)/config.h
 	@printf "    IASL       $$(subst $(top)/,,$$(@))\n"
 	$(CC_ramstage) -x assembler-with-cpp -E -MMD -MT $$(@) -D__ACPI__ -P -include $(src)/include/kconfig.h -I$(obj) -I$(src) -I$(src)/include -I$(src)/arch/$(ARCHDIR-$(ARCH-ramstage-y))/include -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$(basename $$@).asl
 	cd $$(dir $$@); $(IASL) -p $$(notdir $$@) -tc $$(notdir $$(basename $$@)).asl
diff --git a/src/arch/arm64/armv8/secmon/Makefile.inc b/src/arch/arm64/armv8/secmon/Makefile.inc
index 6609692..85c3c0a 100644
--- a/src/arch/arm64/armv8/secmon/Makefile.inc
+++ b/src/arch/arm64/armv8/secmon/Makefile.inc
@@ -38,7 +38,7 @@ secmon-y += ../exception.c
 secmon-y += ../../cpu.c
 secmon-y += ../../transition_asm.S ../../transition.c
 
-ramstage-srcs += $(SECMON_BIN)
+ramstage-srcs += $(SECMON_BIN).o
 
 $(SECMON_OBJ):  $$(secmon-objs)
 		$(CC_secmon) $(LDFLAGS) -nostdlib -r -o $@ $^
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index e6b4bad..8e6ad6d 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -196,7 +196,7 @@ $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/
 	mv $@.tmp $@
 endif
 
-romstage-srcs += $(objgenerated)/crt0.s
+romstage-srcs += $(objgenerated)/crt0.S
 
 romstage-libs ?=
 
@@ -237,11 +237,11 @@ $(objgenerated)/crt0.romstage.S: $$(crt0s)
 	@printf "    GEN        $(subst $(obj)/,,$(@))\n"
 	printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@
 
-$(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.s
+$(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.S
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
 	$(CC_romstage) $(CFLAGS_x86_32) $(DISASSEMBLY) -c -o $@ $<  > $(basename $@).disasm
 
-$(objgenerated)/crt0.s: $(objgenerated)/crt0.romstage.S $(obj)/config.h $(obj)/build.h
+$(objgenerated)/crt0.S: $(objgenerated)/crt0.romstage.S $(obj)/config.h $(obj)/build.h
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
 	$(CC_romstage) $(CPPFLAGS_romstage) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/x86/include -I$(obj) -include $(obj)/config.h -include $(obj)/build.h -I. -I$(src) $< -o $@
 
diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc
index 2347f88..8790eaf 100644
--- a/src/cpu/x86/Makefile.inc
+++ b/src/cpu/x86/Makefile.inc
@@ -12,7 +12,7 @@ SIPI_BIN=$(SIPI_ELF:.elf=)
 SIPI_DOTO=$(SIPI_ELF:.elf=.o)
 
 ifeq ($(CONFIG_PARALLEL_MP),y)
-ramstage-srcs += $(SIPI_BIN)
+ramstage-srcs += $(SIPI_BIN).o
 endif
 rmodules_$(ARCH-ramstage-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
 
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc
index b62288a..f409c24 100644
--- a/src/cpu/x86/smm/Makefile.inc
+++ b/src/cpu/x86/smm/Makefile.inc
@@ -58,8 +58,8 @@ smm-y += smm_module_handler.c
 
 ramstage-y += smm_module_loader.c
 
-ramstage-srcs += $(obj)/cpu/x86/smm/smm
-ramstage-srcs += $(obj)/cpu/x86/smm/smmstub
+ramstage-srcs += $(obj)/cpu/x86/smm/smm.o
+ramstage-srcs += $(obj)/cpu/x86/smm/smmstub.o
 
 # SMM Stub Module. The stub is used as a trampoline for relocation and normal
 # SMM handling.
@@ -99,7 +99,7 @@ else # CONFIG_SMM_MODULES
 
 ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.S
 ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
-ramstage-srcs += $(obj)/cpu/x86/smm/smm_wrap
+ramstage-srcs += $(obj)/cpu/x86/smm/smm_wrap.o
 endif
 
 # Use TSEG specific entry point and linker script



More information about the coreboot-gerrit mailing list