Summary:ASTERISK-13871: [patch] Make. Parallel build on multi CPU host
Reporter:Dmytro Mishchenko (arkadia)Labels:
Date Opened:2009-03-31 16:10:16Date Closed:2009-10-21 18:47:24
Versions:Frequency of
Environment:Attachments:( 0) make_paral_ptch
Description:On multi CPU  host you can build project several times faster if you tell 'make' to execute several jobs at a time.

E.g. for dual core PC:
make -j 2

Asterisk Makefile doesn't support -j option too well because of overriding $(MAKE) variable.

Comments:By: John Todd (jtodd) 2009-04-01 21:23:12

I'm not a "makefile" expert by any means.  In fact, the "-j" option is new to me.  This patch would seem useful if there existed a menuselect function (or perhaps just an auto-detect in ./configure?) which automatically detected the number of CPUs in the system and assigned the appropriate value to the make options.   Many machines now come with at least two cores, and often many more than that.  Having a default behavior that takes advantage of the additional speed seems like it would be desirable.

Or is this automating too much?

By: Dmytro Mishchenko (arkadia) 2009-04-02 02:33:01

Check this page for more description of this option:

I would leave it up to user how to run make. If he likes to have this as a default behaviour he can set environment var MAKEFLAGS=-j2 or -j4.

By: Dmytro Mishchenko (arkadia) 2009-04-02 02:58:55

Here is Asterisk build time stats from my pc:

> make clean; time make
real    3m31.413s
user    3m16.896s
sys     0m15.301s

> make clean; time make -j 2
real    1m48.100s
user    3m13.608s
sys     0m13.861s

By: Jason Parker (jparker) 2009-10-06 11:57:17

This was fixed in svn not too long ago.  The approach taken was a little different, but results are the same.