From 81b09f40087d1a00afe30e379d2e8460203b1c5c Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 23 Jan 2016 00:50:00 +0100 Subject: Makefile: Make full use of src-to-obj macro There were several spots in the tree where the path to a per class object file was hardcoded. To make use of the src-to-obj macro for this, it had to be moved before the inclusion of subdirs. Which is fine, as it doesn't have dependencies beside $(obj). Tested by verifying that the resulting coreboot.rom files didn't change for all of Jenkins' abuild configurations. Change-Id: I2eb1beeb8ae55872edfd95f750d7d5a1cee474c4 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/13180 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/vendorcode/amd/pi/Makefile.inc | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src/vendorcode/amd/pi/Makefile.inc') diff --git a/src/vendorcode/amd/pi/Makefile.inc b/src/vendorcode/amd/pi/Makefile.inc index 79d6171d95..4aa8906d43 100644 --- a/src/vendorcode/amd/pi/Makefile.inc +++ b/src/vendorcode/amd/pi/Makefile.inc @@ -81,22 +81,21 @@ CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS) ####################################################################### define create_agesa_cp_template - # $1 AGESA source file -# $2 AGESA copy-to location -$(agesa_src_path)/$(notdir $2): $2 $(agesa_src_path) - @printf " AGESA Copying $$(notdir $2) => $$(@D)\n" - if [ ! -r $(agesa_src_path)/$(notdir $2) ]; then \ - cp -f $2 $$(@D); \ + +$(agesa_src_path)/$(notdir $1): $1 + @printf " AGESA Copying $$(notdir $1) => $$(@D)\n" + if [ ! -r $(agesa_src_path)/$(notdir $1) ]; then \ + cp -f $1 $$(@D); \ fi -$(agesa_obj_path)/$1.libagesa.o: $(agesa_src_path)/$(notdir $2) $(obj)/config.h $(src)/include/kconfig.h $(agesa_obj_path) - @printf " CC $(subst $(agesa_obj_path)/,,$$(@))\n" +$(call src-to-obj,libagesa,$1): $(agesa_src_path)/$(notdir $1) $(obj)/config.h $(src)/include/kconfig.h + @printf " CC $$(subst $(obj)/,,$$(@))\n" $(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \ $(AGESA_INC) \ -include $(obj)/config.h -include $(src)/include/kconfig.h \ -o $$@ \ - $(agesa_src_path)/$(notdir $2) + $(agesa_src_path)/$(notdir $1) endef @@ -120,21 +119,15 @@ $(eval $(call create_class_compiler,libagesa,x86_64)) endif agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) -agesa_obj_path := $(strip $(obj)/vendorcode/amd) agesa_src_path := $(strip $(obj)/agesa) -agesa_src_copies := $(strip $(foreach file,$(agesa_src_files),$(agesa_obj_path)/$(notdir $(file)))) -agesa_obj_copies := $(strip $(agesa_src_copies:.c=.libagesa.o)) - -$(agesa_src_path): - mkdir -p $@ +agesa_dirs := $(sort $(abspath $(dir $(call src-to-obj,libagesa,$(agesa_src_files))))) -$(agesa_obj_path): - mkdir -p $@ +additional-dirs += $(agesa_src_path) $(agesa_dirs) -$(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(basename $(notdir $(file))),$(file)))) +$(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(file)))) -$(obj)/agesa/libagesa.a: $(agesa_obj_copies) - @printf " AGESA $(subst $(agesa_obj_path)/,,$(@))\n" +$(obj)/agesa/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files)) + @printf " AGESA $(subst $(obj)/,,$(@))\n" ar rcs $@ $+ romstage-libs += $(obj)/agesa/libagesa.a -- cgit v1.2.3