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 --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c46c4d8eb9..3652559595 100644 --- a/Makefile +++ b/Makefile @@ -180,6 +180,12 @@ add-special-class= \ $(eval $(1):=) \ $(eval special-classes+=$(1)) +# 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),$(subst .$(1),,$(basename $(patsubst src/%,$(obj)/%,$(file)))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file))))) + # Clean -y variables, include Makefile.inc # Add paths to files in X-y to X-srcs # Add subdirs-y to subdirs @@ -215,12 +221,6 @@ endif # Eliminate duplicate mentions of source files in a class $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) -# 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),$(subst .$(1),,$(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) -- cgit v1.2.3