Make: Use unaltered object list for dependency inclusion

It looks like the inclusion of dependency files was broken for all
ramstage objects since the list of those gets processed through the
ramstage-postprocess macro. Fix that by taking the unaltered list
for dependency files.

The output of `make printall` (look for DEPENDENCIES=) shows which
dependency files will be included.

See also:

    commit 79f9010e80a04f2e0fb0cca5759e3215dff79aff
    Author: Patrick Georgi <>
    Date:   Sun Nov 25 14:31:08 2012 +0100

        build system: Add hook to postprocess classes (object lists)


    commit f33e395213f0516a9256f33ede4c6bba3babb0e9
    Author: Patrick Georgi <>
    Date:   Sun Nov 25 17:10:47 2012 +0100

        build system: Split linking into multiple steps

Change-Id: If93b1773c5d53240f98382aab11bf7f5a4649ee8
Signed-off-by: Nico Huber <>
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <>
Reviewed-by: Patrick Georgi <>
diff --git a/Makefile b/Makefile
index 9aafe7c..dec32e5 100644
--- a/Makefile
+++ b/Makefile
@@ -242,6 +242,9 @@
 src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs))))
 $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class))))
+# Save all objs before processing them (for dependency inclusion)
+originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
 # Call post-processors if they're defined
 $(foreach class,$(classes),\
 	$(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs)))))
@@ -273,7 +276,7 @@
 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 = $(allobjs:.o=.d)
+DEPENDENCIES = $(originalobjs:.o=.d)
 -include $(DEPENDENCIES)