[BusyBox] Compilation Speed

busybox at rich-paul.net busybox at rich-paul.net
Thu Jul 28 17:48:13 UTC 2005


I've noticed that when I compile busybox on my laptop, it compiles more
slowly than one would expect, and although it's a (more-or-less)
multiprocessor system and I use -j5, make never seems to run more than one
job at a time.

I believe I have found the culprit:  each time a file is compiled, gcc
runs about 5 times.  This is because the $(check_gcc) macros and the
TARGET_ARCH macros are late binding.

The attached patch cuts the compilation time by 66%, from 1.5 minutes to
30 seconds.  Your mileage may very.  These statements have not been
evaluated by the FDA.



-- 
Never let 'em tell you the drug war is a total failure.  It's preventing sick
people from getting enough pain medication, isn't it?

http://radical-centrist.blogspot.com
-------------- next part --------------
--- Rules.mak.orig	2005-07-27 16:31:45.000000000 -0400
+++ Rules.mak	2005-07-27 16:31:27.000000000 -0400
@@ -86,7 +86,7 @@
 #--------------------------------------------------------
 export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
 ifeq ($(strip $(TARGET_ARCH)),)
-TARGET_ARCH=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
+TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
 		-e 's/i.86/i386/' \
 		-e 's/sparc.*/sparc/' \
 		-e 's/arm.*/arm/g' \
@@ -115,8 +115,7 @@
 # for OPTIMIZATION...
 
 # use '-Os' optimization if available, else use -O2
-OPTIMIZATION=
-OPTIMIZATION=${call check_gcc,-Os,-O2}
+OPTIMIZATION:=${call check_gcc,-Os,-O2}
 
 # Some nice architecture specific optimizations
 ifeq ($(strip $(TARGET_ARCH)),arm)


More information about the busybox mailing list