1*4882a593SmuzhiyunDon't build object files twice 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunWhen passed --enable-static and --enable-shared, icu will generate 4*4882a593Smuzhiyunboth a shared and a static version of its libraries. 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunHowever, in order to do so, it builds each and every object file 7*4882a593Smuzhiyuntwice: once with -fPIC (for the shared library), and once without 8*4882a593Smuzhiyun-fPIC (for the static library). While admittedly building -fPIC for a 9*4882a593Smuzhiyunstatic library generates a slightly suboptimal code, this is what all 10*4882a593Smuzhiyunthe autotools-based project are doing. They build each object file 11*4882a593Smuzhiyunonce, and they use it for both the static and shared libraries. 12*4882a593Smuzhiyun 13*4882a593Smuzhiyunicu builds the object files for the shared library as .o files, and 14*4882a593Smuzhiyunthe object files for static library as .ao files. By simply changing 15*4882a593Smuzhiyunthe suffix of object files used for static libraries to ".o", we tell 16*4882a593Smuzhiyunicu to use the ones built for the shared library (i.e, with -fPIC), 17*4882a593Smuzhiyunand avoid the double build of icu. 18*4882a593Smuzhiyun 19*4882a593SmuzhiyunOn a fast build server, this brings the target icu build from 20*4882a593Smuzhiyun3m41.302s down to 1m43.926s (approximate numbers: some other builds 21*4882a593Smuzhiyunare running on the system at the same time). 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunIndex: b/source/config/mh-linux 26*4882a593Smuzhiyun=================================================================== 27*4882a593Smuzhiyun--- a/source/config/mh-linux 28*4882a593Smuzhiyun+++ b/source/config/mh-linux 29*4882a593Smuzhiyun@@ -35,7 +35,7 @@ 30*4882a593Smuzhiyun ## Shared object suffix 31*4882a593Smuzhiyun SO = so 32*4882a593Smuzhiyun ## Non-shared intermediate object suffix 33*4882a593Smuzhiyun-STATIC_O = ao 34*4882a593Smuzhiyun+STATIC_O = o 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun ## Compilation rules 37*4882a593Smuzhiyun %.$(STATIC_O): $(srcdir)/%.c 38