summaryrefslogtreecommitdiff
path: root/src/vendorcode/amd
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2016-01-23 00:50:00 +0100
committerNico Huber <nico.h@gmx.de>2016-01-28 00:31:00 +0100
commit81b09f40087d1a00afe30e379d2e8460203b1c5c (patch)
treef4afa32a6823caffe26009bddc6f5bfc81aa8574 /src/vendorcode/amd
parent116d67323b78cad4b0ddd354fc154c4e4ac60225 (diff)
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 <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/13180 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/vendorcode/amd')
-rw-r--r--src/vendorcode/amd/pi/Makefile.inc33
1 files changed, 13 insertions, 20 deletions
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