Speed up parallel builds

- make should be $(MAKE)
 - add + in front of rules spawning long-lasted make process in a
subshell. (This would not be needed with $(MAKE) -C .. target, but our
makefiles do not handle that because they use $(PWD))
 - split the main 'all' rule as all 4 targets are independant
 - fix dependencies where appropriate for parallelism

Extra, not speed-related changes:
 - remove some double-colon for targets as they do not need it

This cuts build time from 5s to 1.5s on a laptop with -j4, and more
importantly from 85s to 35s on a KNL node.
As a bonus, the fixed dependencies removes the need to clean before
rebuilding all the time. Probably.
This commit is contained in:
Dominique Martinet
2017-09-14 17:17:25 +09:00
parent b962da700b
commit b894619d1b
5 changed files with 32 additions and 24 deletions

View File

@ -65,8 +65,8 @@ Makefile.dep:
$(IHKOBJ): FORCE
@mkdir -p $(dir $(IHKOBJ))
$(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS) prepare
$(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS)
+$(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS) prepare
+$(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS)
%.o: $(SRC)/%.c
$(cc_cmd)

View File

@ -26,9 +26,9 @@ all: $(O) $(KERNELS)
$(O):
mkdir -p $(O)
%/kernel.img: %/Makefile
%/kernel.img: %/Makefile $(KERNELS)
@echo 'Building for' $(dir $@)
@make --no-print-directory -C $(dir $@) $(SUBCMD_OPTS)
+@make --no-print-directory -C $(dir $@) $(SUBCMD_OPTS)
%/Makefile: Makefile.build FORCE
@mkdir -p $(dir $@)