Makefile: Add a build target for .map
We don't currently have a build target defined for .map files. This
means they can't be used as a dependency. This change splits the .map
creation into its own rule.
BUG=b:221231786
TEST=Build guybrush and verify .map still exists
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I1ce21902e97390aa9520670299ef08debf4458db
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62399
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Martin Roth <martinroth@google.com>
diff --git a/Makefile.inc b/Makefile.inc
index f584189..ec2d097 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -791,11 +791,14 @@
$(objcbfs)/%.bin: $(objcbfs)/%.raw.bin
cp $< $@
-$(objcbfs)/%.elf: $(objcbfs)/%.debug
+$(objcbfs)/%.map: $(objcbfs)/%.debug
+ $(eval class := $(call find-class,$(@F)))
+ $(NM_$(class)) -n $< | sort > $(basename $@).map
+
+$(objcbfs)/%.elf: $(objcbfs)/%.debug $(objcbfs)/%.map
$(eval class := $(call find-class,$(@F)))
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
cp $< $@.tmp
- $(NM_$(class)) -n $@.tmp | sort > $(basename $@).map
$(OBJCOPY_$(class)) --strip-debug $@.tmp
$(OBJCOPY_$(class)) --add-gnu-debuglink=$< $@.tmp
mv $@.tmp $@