Recursive make speedup patch

Kris Kennaway kris at
Sun Jan 25 16:08:20 PST 2004

The patch available at

gives a 43% speedup for 'make index' in my testing:

No optimization
1899.40 real       648.67 user      1148.96 sys

Optimized version
1096.76 real       504.48 user       565.90 sys

The optimizations I used were:

* Don't unconditionally include <> twice for every port;
only do so if the port defines USE_GNOME or WANT_GNOME.  I had to
modify a couple of ports to make this work, and I'm not 100% certain
there are no unintended side-effects.

* Pass down some more variables from instead of
assigning them by forking a shell to evaluate a command in each child

* Don't invoke perl just to print a string in 'make describe'

* Use make transformation magic instead of invoking 'basename' in a

There are some more things that could be looked at, but they're more
difficult and the benefits are unknown:

* A lot of the variable assignments in (e.g. CONFIGURE
stuff) are not necessary for recursive targets like 'make describe'.
They could be hidden behind a conditional and avoided unless we're
actually doing a port build.  I'm not sure how expensive these are
though, so it may not be worth it.

* I tried using make -jX to build the INDEX in parallel, but I ended
up with overlapping output from the child makes and a corrupted INDEX.
There should be some way to make it work.

* 'make index' and 'make describe' use some perl code, which might be
optimized or rewritten (e.g. replaced by an awk script, which would
have the further benefit of working out of the box on 5.x).

I have not yet tried a port build with these patches - I'd be most
concerned about the inclusion change.  Please let me know
if you run into any problems.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-ports mailing list