[coreboot] New patch to review for coreboot: cc36cd1 Makefile: define build result directories
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Wed Apr 4 00:50:27 CEST 2012
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/858
-gerrit
commit cc36cd1f5149a5cd2f79b3caa23fbf0d07956e45
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Tue Apr 3 17:52:22 2012 +0300
Makefile: define build result directories
Final build results (.elf, .debug, .map) are to be placed under
directory $(objcbfs), the default is:
$(obj)/cbfs/$(CONFIG_CBFS_PREFIX)/
Intermediate build results (.o, .s, .S, .inc, .ld) are to be placed
under directory $(objsec), the default is:
$(obj)/mainboard/$(MAINBOARDDIR)/
Also defines implicit rules for final build results:
.debug -> .elf and .map
.elf -> .bin
Change-Id: I448c6b7c9a952e54170df42091d7db438025a795
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
Makefile.inc | 10 ++++++++--
src/arch/x86/Makefile.inc | 15 +++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 81d40df..b321270 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -27,14 +27,17 @@ ARCHDIR-$(CONFIG_ARCH_X86) := x86
MAINBOARDDIR=$(call strip_quotes,$(CONFIG_MAINBOARD_DIR))
export MAINBOARDDIR
+export objcbfs := $(obj)/cbfs/$(CONFIG_CBFS_PREFIX)
+export objsec := $(obj)/mainboard/$(MAINBOARDDIR)
+
#######################################################################
# root rule to resolve if in build mode (ie. configuration exists)
real-target: $(obj)/config.h coreboot
-coreboot: $(obj)/coreboot.rom
+coreboot: build-dirs $(obj)/coreboot.rom
#######################################################################
# our phony targets
-PHONY+= clean-abuild coreboot lint lint-stable
+PHONY+= clean-abuild coreboot lint lint-stable build-dirs
#######################################################################
# root source directories of coreboot
@@ -164,6 +167,9 @@ $(obj)/build.h: .xcompile
$(obj)/ldoptions: $(obj)/config.h
awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@
+build-dirs:
+ mkdir -p $(objcbfs) $(objsec)
+
#######################################################################
# Build the tools
CBFSTOOL:=$(obj)/cbfstool
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 8783d4b..c5faf5b 100755
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -142,6 +142,21 @@ $(objutil)/options/build_opt_tbl: $(top)/util/options/build_opt_tbl.c $(top)/src
$(HOSTCC) $(HOSTCFLAGS) $< -o $@
#######################################################################
+# Common recipes for all stages
+
+$(objcbfs)/%.bin: $(objcbfs)/%.elf
+ @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
+ $(OBJCOPY) -O binary $< $@
+
+$(objcbfs)/%.elf: $(objcbfs)/%.debug
+ @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
+ cp $< $@.tmp
+ $(NM) -n $@.tmp | sort > $(basename $@).map
+ $(OBJCOPY) --strip-debug $@.tmp
+ $(OBJCOPY) --add-gnu-debuglink=$< $@.tmp
+ mv $@.tmp $@
+
+#######################################################################
# Build the coreboot_ram (stage 2)
$(obj)/coreboot_ram: $(obj)/coreboot_ram.o $(src)/arch/x86/coreboot_ram.ld #ldoptions
More information about the coreboot
mailing list