help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Best practice for parallelism with multiple targets


From: Adam Kellas
Subject: Best practice for parallelism with multiple targets
Date: Sat, 12 Jun 2010 12:01:56 -0400

I have a tool which generates Makefiles in GNU make syntax. In the case where a recipe produces multiple ("sibling") targets, the first, naive iteration of the tool simply stacked them up like

target1 target2 target3 ... : prereq1 prereq2 ...
         [recipe]

Of course this breaks parallel builds due to a well-known, well-documented quirk of make semantics. So in the second go-round I've modified it to instead generate

target1: prereq1 prereq2 ...
        [recipe]

target2 target3 ... : target1

This works better with -j but has run into some other problems which are limitations of our tool, not make, so I won't waste time detailing them. Bottom line, what's the recommended way to write Makefiles so as to enable parallel builds? Is there anything better than the above?

Thanks,
AK

reply via email to

[Prev in Thread] Current Thread [Next in Thread]