From 51e142fef4c47b6ba30b9aaf5f3fcf34c781b59a Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sat, 27 Mar 2010 17:18:39 +0000 Subject: make only needs to read Makefile.incs once, thanks to the SECONDEXPANSION feature of GNU make (and we rely on GNU make for lots of things already) File paths are relative to the root directory, which simplifies debugging (make V=1 gives shorter command lines) and helps ccache finding matches for checkouts in different directories (even though it should normalize paths itself) Signed-off-by: Patrick Georgi Acked-by: Ronald G. Minnich git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5304 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/arch/i386/Makefile.bigbootblock.inc | 9 +++------ src/arch/i386/Makefile.bootblock.inc | 13 +++++-------- src/arch/i386/Makefile.inc | 17 +++++------------ src/arch/i386/lib/Makefile.inc | 5 ----- 4 files changed, 13 insertions(+), 31 deletions(-) (limited to 'src/arch') diff --git a/src/arch/i386/Makefile.bigbootblock.inc b/src/arch/i386/Makefile.bigbootblock.inc index cae7470dc6..fc9b0ec584 100644 --- a/src/arch/i386/Makefile.bigbootblock.inc +++ b/src/arch/i386/Makefile.bigbootblock.inc @@ -1,5 +1,3 @@ -ifdef POST_EVALUATION - ####################################################################### # Build the final rom image @@ -14,11 +12,11 @@ $(obj)/coreboot.bootblock: $(obj)/coreboot @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" $(OBJCOPY) -O binary $< $@ -$(obj)/ldscript.ld: $(ldscripts) $(obj)/ldoptions +$(obj)/ldscript.ld: $$(ldscripts) $(obj)/ldoptions printf 'INCLUDE "ldoptions"\n' > $@ printf '$(foreach ldscript,$(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@ -$(obj)/crt0_includes.h: $(crt0s) +$(obj)/crt0_includes.h: $$(crt0s) @printf " GEN $(subst $(obj)/,,$(@))\n" printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ @@ -30,9 +28,8 @@ $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/ @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -MMD -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -include $(obj)/config.h -I. -I$(src) $< > $@.new && mv $@.new $@ -$(obj)/coreboot: $(initobjs) $(obj)/ldscript.ld +$(obj)/coreboot: $$(initobjs) $(obj)/ldscript.ld @printf " LINK $(subst $(obj)/,,$(@))\n" $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(obj)/ldscript.ld $(initobjs) $(NM) -n $(obj)/coreboot | sort > $(obj)/coreboot.map -endif diff --git a/src/arch/i386/Makefile.bootblock.inc b/src/arch/i386/Makefile.bootblock.inc index e767f30458..6d9e7414d8 100644 --- a/src/arch/i386/Makefile.bootblock.inc +++ b/src/arch/i386/Makefile.bootblock.inc @@ -1,5 +1,3 @@ -ifdef POST_EVALUATION - ####################################################################### # Build the final rom image @@ -49,12 +47,12 @@ ifeq ($(CONFIG_SSE),y) bootblock_romccflags := -mcpu=k7 -msse -O2 endif -$(obj)/bootblock/ldscript.ld: $(bootblock_ldscripts) $(obj)/ldoptions +$(obj)/bootblock/ldscript.ld: $$(bootblock_lds) $(obj)/ldoptions @printf " GEN $(subst $(obj)/,,$(@))\n" mkdir -p $(obj)/bootblock printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@ -$(obj)/bootblock/bootblock.c: $(bootblock_inc) +$(obj)/bootblock/bootblock.c: $$(bootblock_inc) @printf " GEN $(subst $(obj)/,,$(@))\n" mkdir -p $(obj)/bootblock printf '$(foreach crt0,config.h $(bootblock_inc),#include "$(crt0)"\n)' > $@ @@ -80,7 +78,7 @@ $(obj)/bootblock.elf: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o $(obj)/bootbl ####################################################################### # Build the romstage -$(obj)/coreboot.romstage: $(obj)/coreboot.pre1 $(initobjs) $(obj)/romstage/ldscript.ld +$(obj)/coreboot.romstage: $(obj)/coreboot.pre1 $$(initobjs) $(obj)/romstage/ldscript.ld @printf " LINK $(subst $(obj)/,,$(@))\n" printf "CONFIG_ROMBASE = 0x0;\nAUTO_XIP_ROM_BASE = 0x0;\n" > $(obj)/location.ld $(CC) -nostdlib -nostartfiles -static -o $(obj)/romstage.elf -L$(obj) -T $(obj)/romstage/ldscript.ld $(initobjs) @@ -93,12 +91,12 @@ $(obj)/coreboot.romstage: $(obj)/coreboot.pre1 $(initobjs) $(obj)/romstage/ldscr $(NM) -n $(obj)/romstage.elf | sort > $(obj)/romstage.map $(OBJCOPY) -O binary $(obj)/romstage.elf $@ -$(obj)/romstage/ldscript.ld: $(ldscripts) $(obj)/ldoptions +$(obj)/romstage/ldscript.ld: $$(ldscripts) $(obj)/ldoptions @printf " GEN $(subst $(obj)/,,$(@))\n" mkdir -p $(obj)/romstage printf '$(foreach ldscript,ldoptions location.ld $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' > $@ -$(obj)/romstage/crt0_includes.h: $(crt0s) +$(obj)/romstage/crt0_includes.h: $$(crt0s) @printf " GEN $(subst $(obj)/,,$(@))\n" mkdir -p $(obj)/romstage printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ @@ -111,4 +109,3 @@ $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/ @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -I$(obj)/romstage -include $(obj)/config.h -I. -I$(src) $< > $@.new && mv $@.new $@ -endif diff --git a/src/arch/i386/Makefile.inc b/src/arch/i386/Makefile.inc index 02fafba086..575dab902b 100644 --- a/src/arch/i386/Makefile.inc +++ b/src/arch/i386/Makefile.inc @@ -7,8 +7,6 @@ subdirs-y += smp obj-$(CONFIG_HAVE_OPTION_TABLE) += ../../option_table.o -ifdef POST_EVALUATION - ####################################################################### # Build the final rom image COREBOOT_ROM_DEPENDENCIES:= @@ -73,14 +71,14 @@ $(obj)/coreboot_ram: $(obj)/coreboot_ram.o $(src)/arch/i386/coreboot_ram.ld #ldo $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/i386/coreboot_ram.ld $(obj)/coreboot_ram.o $(NM) -n $(obj)/coreboot_ram | sort > $(obj)/coreboot_ram.map -$(obj)/coreboot_ram.o: $(obj)/arch/i386/lib/c_start.o $(drivers) $(obj)/coreboot.a $(LIBGCC_FILE_NAME) +$(obj)/coreboot_ram.o: $(obj)/arch/i386/lib/c_start.o $$(drivers) $(obj)/coreboot.a $(LIBGCC_FILE_NAME) @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -nostdlib -r -o $@ $(obj)/arch/i386/lib/c_start.o $(drivers) -Wl,--start-group $(obj)/coreboot.a $(LIBGCC_FILE_NAME) -Wl,--end-group -$(obj)/coreboot.a: $(objs) +$(obj)/coreboot.a: $$(objs) @printf " AR $(subst $(obj)/,,$(@))\n" rm -f $(obj)/coreboot.a - $(AR) cr $(obj)/coreboot.a $(objs) + $(AR) cr $(obj)/coreboot.a $^ ####################################################################### # done @@ -195,7 +193,7 @@ ROMCCFLAGS ?= -mcpu=p2 -O2 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h printf " ROMCC romstage.inc\n" - $(ROMCC) -c -S $(ROMCCFLAGS) -include $(obj)/build.h -I. $(INCLUDES) $< -o $@ + $(ROMCC) -c -S $(ROMCCFLAGS) -I. $(INCLUDES) $< -o $@ else @@ -205,7 +203,7 @@ $(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o: $(src)/mainboard/$(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h printf " CC romstage.inc\n" - $(CC) -MMD $(CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o $@ + $(CC) -MMD $(CFLAGS) -I$(src) -I. -c -S $< -o $@ $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc printf " POST romstage.inc\n" @@ -213,9 +211,6 @@ $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/ mv $@.tmp $@ endif -else -# Only in first pass - # Things that appear in every board initobjs += $(obj)/mainboard/$(MAINBOARDDIR)/crt0.o objs += $(obj)/mainboard/$(MAINBOARDDIR)/mainboard.o @@ -249,8 +244,6 @@ ifeq ($(CONFIG_HAVE_BUS_CONFIG),y) objs += $(obj)/mainboard/$(MAINBOARDDIR)/get_bus_conf.o endif -endif - ifeq ($(CONFIG_TINY_BOOTBLOCK),y) include $(src)/arch/i386/Makefile.bootblock.inc else diff --git a/src/arch/i386/lib/Makefile.inc b/src/arch/i386/lib/Makefile.inc index a1cf617fb2..1b7d36772d 100644 --- a/src/arch/i386/lib/Makefile.inc +++ b/src/arch/i386/lib/Makefile.inc @@ -8,8 +8,3 @@ obj-y += exception.o initobj-y += printk_init.o initobj-y += cbfs_and_run.o - -ifdef POST_EVALUATION -$(obj)/arch/i386/lib/console.o :: $(obj)/build.h -endif - -- cgit v1.2.3