dependency tracking for coreboot

Obviously compile time increases slightly because more work has to be done, but
I'm sure the benefit of having to rm -rf build less often is worth it :-)

Other small changes:
* be a bit more verbose on some of the created files
* move -O2 from compiler rule into bootblock_romccflags
* drop rule needed for util/*.c -> build/*.o as x86emu no longer lives in util.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Myles Watson <mylesgw@gmail.com>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5280 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2010-03-24 15:51:48 +00:00 committed by Stefan Reinauer
parent 9db39d3b43
commit 6bee951c30
5 changed files with 32 additions and 20 deletions

View File

@ -216,11 +216,7 @@ define create_cc_template
de$(EMPTY)fine $(1)_$(2)_template de$(EMPTY)fine $(1)_$(2)_template
$(obj)/$$(1)%$(3).o: src/$$(1)%.$(2) $(obj)/config.h $(obj)/$$(1)%$(3).o: src/$$(1)%.$(2) $(obj)/config.h
printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
$(CC) $(4) $$$$(CFLAGS) -c -o $$$$@ $$$$< $(CC) $(4) -MMD $$$$(CFLAGS) -c -o $$$$@ $$$$<
$(obj)/$$(1)%$(3).o: obj/$$(1)%.$(2) $(obj)/config.h
printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
$(CC) $(4) $$$$(CFLAGS) -c -o $$$$@ $$$$<
en$(EMPTY)def en$(EMPTY)def
endef endef
@ -245,6 +241,9 @@ $(eval $(call usetemplate,drivers,S))
$(eval $(call usetemplate,smmobjs,c)) $(eval $(call usetemplate,smmobjs,c))
$(eval $(call usetemplate,smmobjs,S)) $(eval $(call usetemplate,smmobjs,S))
DEPENDENCIES = $(objs:.o=.d) $(initobjs:.o=.d) $(drivers:.o=.d) $(smmobjs:.o=.d)
-include $(DEPENDENCIES)
printall: printall:
@echo objs:=$(objs) @echo objs:=$(objs)
@echo initobjs:=$(initobjs) @echo initobjs:=$(initobjs)
@ -252,6 +251,7 @@ printall:
@echo smmobjs:=$(smmobjs) @echo smmobjs:=$(smmobjs)
@echo alldirs:=$(alldirs) @echo alldirs:=$(alldirs)
@echo allsrc=$(allsrc) @echo allsrc=$(allsrc)
@echo DEPENDENCIES=$(DEPENDENCIES)
@echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME) @echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME)
printcrt0s: printcrt0s:
@ -316,12 +316,13 @@ doxygen-clean:
clean-for-update: doxygen-clean clean-for-update: doxygen-clean
rm -f $(objs) $(initobjs) $(drivers) $(smmobjs) .xcompile rm -f $(objs) $(initobjs) $(drivers) $(smmobjs) .xcompile
rm -f $(DEPENDENCIES)
rm -f $(obj)/coreboot_ram* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a rm -f $(obj)/coreboot_ram* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a
rm -rf $(obj)/bootblock* $(obj)/romstage* $(obj)/location.* rm -rf $(obj)/bootblock* $(obj)/romstage* $(obj)/location.*
rm -f $(obj)/option_table.* $(obj)/crt0_includes.h $(obj)/ldscript rm -f $(obj)/option_table.* $(obj)/crt0_includes.h $(obj)/ldscript
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm rm -f $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/failover.inc $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc rm -f $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/mainboard/$(MAINBOARDDIR)/dsdt.* rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/mainboard/$(MAINBOARDDIR)/dsdt.*
rm -f $(obj)/cpu/x86/smm/smm_bin.c $(obj)/cpu/x86/smm/smm.* $(obj)/cpu/x86/smm/smm rm -f $(obj)/cpu/x86/smm/smm_bin.c $(obj)/cpu/x86/smm/smm.* $(obj)/cpu/x86/smm/smm
rmdir -p $(alldirs) 2>/dev/null >/dev/null || true rmdir -p $(alldirs) 2>/dev/null >/dev/null || true

View File

@ -23,10 +23,12 @@ $(obj)/crt0_includes.h: $(crt0s)
printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@
$(obj)/mainboard/$(MAINBOARDDIR)/crt0.initobj.o: $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.initobj.o: $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s
$(CC) -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm @printf " CC $(subst $(obj)/,,$(@))\n"
$(CC) -MMD -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm
$(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/crt0_includes.h $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/crt0_includes.h
$(CC) -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 $@ @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" @printf " LINK $(subst $(obj)/,,$(@))\n"

View File

@ -44,27 +44,34 @@ endif
bootblock_inc += $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc bootblock_inc += $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc
bootblock_inc += $(src)/arch/i386/lib/walkcbfs.S bootblock_inc += $(src)/arch/i386/lib/walkcbfs.S
bootblock_romccflags := -mcpu=i386 bootblock_romccflags := -mcpu=i386 -O2
ifeq ($(CONFIG_SSE),y) ifeq ($(CONFIG_SSE),y)
bootblock_romccflags := -mcpu=k7 -msse bootblock_romccflags := -mcpu=k7 -msse -O2
endif endif
$(obj)/bootblock/ldscript.ld: $(bootblock_ldscripts) $(obj)/ldoptions $(obj)/bootblock/ldscript.ld: $(bootblock_ldscripts) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
mkdir -p $(obj)/bootblock mkdir -p $(obj)/bootblock
printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@ 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 mkdir -p $(obj)/bootblock
printf '$(foreach crt0,config.h $(bootblock_inc),#include "$(crt0)"\n)' > $@ printf '$(foreach crt0,config.h $(bootblock_inc),#include "$(crt0)"\n)' > $@
$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.s $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.s
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC) -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm $(CC) -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm
$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.s: $(obj)/bootblock/bootblock.c $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.s: $(obj)/bootblock/bootblock.c
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC) -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -I$(obj)/bootblock -include $(obj)/config.h -I. -I$(src) $< > $@.new && mv $@.new $@ $(CC) -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -I$(obj)/bootblock -include $(obj)/config.h -I. -I$(src) $< > $@.new && mv $@.new $@
$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(src)/arch/i386/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(obj)/romcc $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(src)/arch/i386/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(obj)/romcc
$(obj)/romcc $(bootblock_romccflags) -O2 $(ROMCCFLAGS) $(INCLUDES) $< -o $@ @printf " ROMCC $(subst $(obj)/,,$(@)) $(<)\n"
$(CC) -MM -MT$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc \
$< > $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc.d
$(obj)/romcc $(bootblock_romccflags) $(ROMCCFLAGS) $(INCLUDES) $< -o $@
$(obj)/bootblock.elf: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o $(obj)/bootblock/ldscript.ld $(obj)/bootblock.elf: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o $(obj)/bootblock/ldscript.ld
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
@ -87,6 +94,7 @@ $(obj)/coreboot.romstage: $(obj)/coreboot.pre1 $(initobjs) $(obj)/romstage/ldscr
$(OBJCOPY) -O binary $(obj)/romstage.elf $@ $(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 mkdir -p $(obj)/romstage
printf '$(foreach ldscript,ldoptions location.ld $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' > $@ printf '$(foreach ldscript,ldoptions location.ld $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' > $@
@ -96,9 +104,11 @@ $(obj)/romstage/crt0_includes.h: $(crt0s)
printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@
$(obj)/mainboard/$(MAINBOARDDIR)/crt0.initobj.o: $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.initobj.o: $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC) -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm $(CC) -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm
$(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/romstage/crt0_includes.h $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/romstage/crt0_includes.h
@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 $@ $(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 endif

View File

@ -25,6 +25,7 @@ ifeq ($(CONFIG_BOOTSPLASH),y)
COREBOOT_ROM_DEPENDENCIES+=$(CONFIG_FALLBACK_BOOTSPLASH_FILE) COREBOOT_ROM_DEPENDENCIES+=$(CONFIG_FALLBACK_BOOTSPLASH_FILE)
endif endif
$(obj)/coreboot.rom: $(obj)/coreboot.pre $(obj)/coreboot_ram $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES)) $(obj)/coreboot.rom: $(obj)/coreboot.pre $(obj)/coreboot_ram $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES))
printf " CBFS $(subst $(obj)/,,$(@))\n"
cp $(obj)/coreboot.pre $@.tmp cp $(obj)/coreboot.pre $@.tmp
if [ -f fallback/coreboot_apc ]; \ if [ -f fallback/coreboot_apc ]; \
then \ then \
@ -199,15 +200,17 @@ $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/
else else
$(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o: $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c $(obj)/option_table.h $(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o: $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c $(obj)/option_table.h
$(CC) $(CFLAGS) -I$(src) -I. -c -S $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c -o $@ @printf " CC $(subst $(obj)/,,$(@))\n"
$(CC) -MMD $(CFLAGS) -I$(src) -I. -c -S $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c -o $@
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
printf " CC romstage.inc\n" printf " CC romstage.inc\n"
$(CC) $(CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o $@.tmp1 $(CC) -MMD $(CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o $@
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc
printf " POST romstage.inc\n" printf " POST romstage.inc\n"
sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' $@.tmp1 > $@.tmp sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' $^ > $@.tmp
mv $@.tmp $@ mv $@.tmp $@
rm -f $@.tmp1
endif endif
else else

View File

@ -28,8 +28,4 @@ obj-$(CONFIG_COMPRESSED_PAYLOAD_LZMA) += lzma.o
obj-$(CONFIG_BOOTSPLASH) += jpeg.o obj-$(CONFIG_BOOTSPLASH) += jpeg.o
ifdef POST_EVALUATION
$(obj)/lib/version.o :: $(obj)/build.h
endif
smmobj-y += memcpy.o smmobj-y += memcpy.o