[uClinux-dev] parallel compiles

Mike Frysinger vapier at gentoo.org
Thu Feb 7 00:47:13 EST 2008


On Wednesday 06 February 2008, David McCullough wrote:
> > is there a reason for forcing -j1 in sub-packages ?  we've dropped the
> > -j1 in {lib,user}/Makefile for the DIRS target and generally had great
> > success.  you can really feel the difference on an 8 or 16 proc system. 
> > i also replaced the -j1 for the _only targets with -j$(HOST_NCPU).
>
> Interesting result,  do you have an measured build times with and
> without the change ?  It would be nice to know,  and if the gains
> justify the fixing of any potentially broken sub dirs :-)

just doing a simple `time make AnalogDevices/BF537-STAMP_default` here ...
 - with NON_SMP_BUILD set: ~8min
 - without NON_SMP_BUILD set (and the -j1 pieces removed): ~1.5min
pretty consistent here ... +/-10seconds

> If you have a patch,  send it in and I'll try it here and see how bad it
> is for our builds,  if it's relatively isolated I am happy to fix up
> some bits and include it,  anything that speeds builds is good,

i'm pushing this for our next-next release (so current development tree).  
only noticed net-tools failing so far (but i posted a patch for that)
---
Do not force -j1 in subdirs and use -j$(HOST_NCPU) for _only targets.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
diff --git a/lib/Makefile b/lib/Makefile
index 0de9193..e9e9372 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -136,16 +136,16 @@ all:
 # the actual dir target
 .PHONY: $(DIRS_y)
 $(DIRS_y):
-	[ ! -d "$@" ] || ( touch $@/.sgbuilt_lib && $(MAKE) -j1 -C $@ ) || exit $$?
+	[ ! -d "$@" ] || ( touch $@/.sgbuilt_lib && $(MAKE) -C $@ ) || exit $$?
 
 %_only:
-	touch $(@:_only=)/.sgbuilt_lib && $(MAKE) -j1 -C $(@:_only=)
+	touch $(@:_only=)/.sgbuilt_lib && $(MAKE) -j$(HOST_NCPU) -C $(@:_only=)
 
 %_clean:
 	$(MAKE) -j1 -C $(@:_clean=) clean; rm -f $(@:_clean=)/.sgbuilt_lib; true
 
 %_romfs:
-	$(MAKE) -j1 -C $(@:_romfs=) romfs
+	$(MAKE) -C $(@:_romfs=) romfs
 
 
##############################################################################
 
diff --git a/user/Makefile b/user/Makefile
index d452260..18b8f00 100644
--- a/user/Makefile
+++ b/user/Makefile
@@ -440,16 +440,16 @@ asterisk-addons: mysql asterisk
 miniupnpd : iptables
 
 $(sort $(dir_y) $(dir_p)):  config
-	[ ! -d "$@" ] || ( touch $@/.sgbuilt_user && $(MAKE) -j1 -C $@ ) || exit $$?
+	[ ! -d "$@" ] || ( touch $@/.sgbuilt_user && $(MAKE) -C $@ ) || exit $$?
 
 %_only:
-	touch $(@:_only=)/.sgbuilt_user && $(MAKE) -j1 -C $(@:_only=)
+	touch $(@:_only=)/.sgbuilt_user && $(MAKE) -j$(HOST_NCPU) -C $(@:_only=)
 
 %_clean:
 	$(MAKE) -j1 -C $(@:_clean=) clean; rm -f $(@:_clean=)/.sgbuilt_user; true
 
 %_romfs:
-	$(MAKE) -j1 -C $(@:_romfs=) romfs
+	$(MAKE) -C $(@:_romfs=) romfs
 
 romfs:
 	for i in $(sort $(dir_y)) $(dir_p) ; do \


More information about the uClinux-dev mailing list