Martin Roth (martinroth@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14259
-gerrit
commit c8cdc6fbee38e5b3df657b04a71cc742b1d228c6 Author: Martin Roth martinroth@google.com Date: Tue Apr 5 11:09:22 2016 -0600
Makefile.inc: Don't run submodule init every build
Currently the build tries to init the submodules with every build which leads to a lot of overhead.
This turns the update into a target function which will only try to init the submodules if the submodule directory doesn't exist.
Change-Id: I5c4a40d28f613b752751e3fc75bb55a60b6a802f Signed-off-by: Martin Roth martinroth@google.com --- Makefile.inc | 38 ++++++++++++++++++++++++++++---------- src/arch/arm64/Makefile.inc | 2 +- src/commonlib/Makefile.inc | 8 ++++++++ util/cbfstool/Makefile.inc | 2 +- util/nvidia/Makefile.inc | 4 ++-- util/nvramtool/Makefile.inc | 2 +- 6 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc index 6be9d52..e3db0a8 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -174,14 +174,6 @@ ifeq ($(CONFIG_COVERAGE),y) ramstage-c-ccopts += -fprofile-arcs -ftest-coverage endif
-# try to fetch non-optional submodules if the source is under git -forgetthis:=$(if $(GIT),$(shell git submodule update --init)) -ifeq ($(CONFIG_USE_BLOBS),y) -# this is necessary because 3rdparty/blobs is update=none, and so is ignored -# unless explicitly requested and enabled through --checkout -forgetthis:=$(if $(GIT),$(shell git submodule update --init --checkout 3rdparty/blobs)) -endif - ramstage-c-deps:=$$(OPTION_TABLE_H) romstage-c-deps:=$$(OPTION_TABLE_H) libverstage-c-deps:=$$(OPTION_TABLE_H) @@ -373,12 +365,38 @@ build-dirs: mkdir -p $(objcbfs) $(objgenerated)
####################################################################### +# try to fetch non-optional submodules if the source is under git + +SUBMODULES := \ + 3rdparty/vboot/.git \ + 3rdparty/arm-trusted-firmware/.git \ + 3rdparty/chromeec/.git \ + 3rdparty/blobs/.git \ + util/nvidia/cbootimage/.git + +submodules: $(SUBMODULES) + +3rdparty/vboot/.git 3rdparty/arm-trusted-firmware/.git 3rdparty/chromeec/.git util/nvidia/cbootimage/.git: +ifneq ($(GIT),) + git submodule update --init --checkout $(subst /.git,,$@) +endif + +3rdparty/blobs/.git: +ifeq ($(CONFIG_USE_BLOBS),y) +ifneq ($(GIT),) + git submodule update --init --checkout $(subst /.git,,$@) +endif +endif + +.PHONY: submodules + +####################################################################### # Build the tools CBFSTOOL:=$(objutil)/cbfstool/cbfstool FMAPTOOL:=$(objutil)/cbfstool/fmaptool RMODTOOL:=$(objutil)/cbfstool/rmodtool
-$(obj)/cbfstool: $(CBFSTOOL) +$(obj)/cbfstool: $(CBFSTOOL) | submodules cp $< $@
$(obj)/fmaptool: $(FMAPTOOL) @@ -541,7 +559,7 @@ $(objcbfs)/bootblock.raw.bin: $(objcbfs)/bootblock.elf $(objcbfs)/%.bin: $(objcbfs)/%.raw.bin cp $< $@
-$(objcbfs)/%.elf: $(objcbfs)/%.debug +$(objcbfs)/%.elf: $(objcbfs)/%.debug | submodules $(eval class := $(call find-class,$(@F))) @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" cp $< $@.tmp diff --git a/src/arch/arm64/Makefile.inc b/src/arch/arm64/Makefile.inc index dffdd9c..32fbfa5 100644 --- a/src/arch/arm64/Makefile.inc +++ b/src/arch/arm64/Makefile.inc @@ -170,7 +170,7 @@ BL31_LDFLAGS := --emit-relocs
BL31 := $(obj)/bl31.elf
-$(BL31): $(obj)/build.h +$(BL31): $(obj)/build.h | submodules @printf " MAKE $(subst $(obj)/,,$(@))\n" CROSS_COMPILE="$(CROSS_COMPILE_arm64)" \ CFLAGS="$(BL31_CFLAGS)" \ diff --git a/src/commonlib/Makefile.inc b/src/commonlib/Makefile.inc index 7c14f7c..fec86d9 100644 --- a/src/commonlib/Makefile.inc +++ b/src/commonlib/Makefile.inc @@ -25,3 +25,11 @@ verstage-y += lz4_wrapper.c romstage-y += lz4_wrapper.c ramstage-y += lz4_wrapper.c postcar-y += lz4_wrapper.c + +# cbfs.c needs the vboot submodule to be downloaded before it will compile +$(call src-to-obj,bootblock,$(dir)/cbfs.c) : submodules +$(call src-to-obj,romstage,$(dir)/cbfs.c) : submodules +$(call src-to-obj,ramstage,$(dir)/cbfs.c) : submodules +$(call src-to-obj,smm,$(dir)/cbfs.c) : submodules +$(call src-to-obj,verstage,$(dir)/cbfs.c) : submodules +$(call src-to-obj,postcar,$(dir)/cbfs.c) : submodules diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc index f480616..e097d8e 100644 --- a/util/cbfstool/Makefile.inc +++ b/util/cbfstool/Makefile.inc @@ -109,7 +109,7 @@ $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/%.c printf " HOSTCC $(subst $(objutil)/,,$(@))\n" $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
-$(objutil)/cbfstool/%.o: $(top)/3rdparty/vboot/firmware/2lib/%.c +$(objutil)/cbfstool/%.o: $$(top)/3rdparty/vboot/firmware/2lib/%.c printf " HOSTCC $(subst $(objutil)/,,$(@))\n" $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
diff --git a/util/nvidia/Makefile.inc b/util/nvidia/Makefile.inc index 133778f..db569d7 100644 --- a/util/nvidia/Makefile.inc +++ b/util/nvidia/Makefile.inc @@ -45,11 +45,11 @@ CBOOTIMAGE_FLAGS:=-Wall -std=c99 -O2
additional-dirs += $(sort $(dir $(CBOOTIMAGE_OBJS)))
-$(objutil)/nvidia/cbootimage/%.o: util/nvidia/cbootimage/src/%.c +$(objutil)/nvidia/cbootimage/%.o: $$(top)/util/nvidia/cbootimage/src/%.c printf " HOSTCC $(subst $(objutil)/,,$(@))\n" $(HOSTCC) $(CBOOTIMAGE_FLAGS) -c -o $@ $<
-$(CBOOTIMAGE): $(CBOOTIMAGE_OBJS) +$(CBOOTIMAGE): $(CBOOTIMAGE_OBJS) | submodules printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" $(HOSTCC) $(CBOOTIMAGE_FLAGS) -o $@.tmp $^ -lm mv $@.tmp $@ diff --git a/util/nvramtool/Makefile.inc b/util/nvramtool/Makefile.inc index 48f6d86..d78ec11 100644 --- a/util/nvramtool/Makefile.inc +++ b/util/nvramtool/Makefile.inc @@ -36,7 +36,7 @@ NVRAMTOOLLDFLAGS += -lregex -lwsock32 nvramtoolobj += win32mmap.o endif
-$(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli: +$(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli: submodules mkdir -p $@
$(objutil)/nvramtool/%.o: $(top)/util/nvramtool/%.c