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