On Wed, 2011-04-13 at 13:24 +0200, Toralf Förster wrote: > related to the parallel build capabilities I'm wondering how make does > optimize the build process.
It doesn't. > Considering 2 make processes in parallel and 3 independend directories, 2 > should have 100 and 1 should have 200 source files. In this case make should > start with the bigger directory with one build process and with one of the > other 2 (smaller) directories with another process, right ? I don't think you're understanding the model. Make doesn't spawn "worker processes" like that. If you have a recipe that runs a sub-make, then make spawns a new make. If your recipe doesn't run a new make, then your entire build will be managed by a single make process. Also why would it matter which directory make built first if they are independent? > Or doesn't make looks forward in this way and simple works with the 3 > directory in another (alphabetical) sorted order ? Make always walks the dependency tree in the same basic order (although parallelism can cause things to be started at different times). Make never knows the future: it has no way of knowing even how many more steps there are in the current make invocation before it's done, much less how many there may be in some other make process. It's not that make first scans the entire dependency tree and computes all the steps needed first then runs them; that would be impossible because the completion of one step can impact multiple other steps in non-deterministic ways. Instead, after make reads in all the makefiles and finishes creating the full dependency tree, it simply starts walking the tree, building things as needed. It stops when there's nothing left to build (when the starting goal is up to date). -- ------------------------------------------------------------------------------- Paul D. Smith <[email protected]> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
