On Wed, 16 Oct 2013 11:07:11 +0200 Riccardo Manfrin <[email protected]> wrote:
> On 10/16/2013 10:54 AM, Riccardo Manfrin wrote: > > How to force precedence in target rules when invoking make with -jn > > with n>1 (on a multi core/threads machine)? > > > > Let me clarify: > > > > I have the following tagets/prerequisites rules: > > > > all: $(MYLIB) TEST > > $(MYLIB): > > .... > > TEST: > > ... These rules are faulty, because ... > > With -j1 I get the library archived before the test. With -j8 I always > > get test done before the library (and therefore an error). ... TEST depends on $(MYLIB) and you didn't specify $(MYLIB) as a prerequisite for TEST. With -j1 make processes the prerequisites in the order of appearence, with -j8 make processes as many prerequisites as possible at the same time. I'll repeat myself to be clear: The order of prerequisites does NOT tell make about dependencies between the prerequisites, that's what prerequisites are for. You have to tell make about this dependency yourself ... ... exactly the way you did it here: > I quite solved myself, although I'm not sure this is ok, it works: > all: $(MYLIB) TEST > $(MYLIB): > .... > TEST: $(MYLIB) > ... > > I could solve by putting $(MYLIB) as a prerequisite of TEST, but I don't > > want to pass through (=depend on) TEST for compiling the library. I > > would like to be able to exclude TEST on demand and stll compile the library You don't depend on TEST to compile the library, because the prerequisite list of target $(MYLIB) is empty. Just call "make $(MYLIB)" (the name of your library) and make will just build the library without TEST. Regards Michael _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
