multiple targets created by one command verses --jobs 2
From:
dave russo
Subject:
multiple targets created by one command verses --jobs 2
Date:
Mon, 02 Dec 2002 13:51:32 -0800
I've run into a problem using make's job server capability because of
a command that generates several targets in one execution. The job
server runs the command multiple times (concurrently) for each target
but, because the command is designed to create all targets at once, the
command interferes with itself and the build fails. Even if I fix
the command to not interfere with itself, I don't want it to run more
than once.
I understand that by using pattern rules multiple targets can be built by
running a rule just once, but I don't see a good way to express this
particular command as a pattern rule.
This "works" when --jobs is set to 1 because make
re-checks dependencies after running rules: the rule is run once if any
idl file changes, if one or more generated file is inadvertently deleted,
or if one or more the generated files is named on the command
line.
This fails when --jobs is set to anything greater than 1 because make
sees that foo.h and bar.h are required (by other parts of the build) and
concurrently runs the idl command.
I tried converting this to a pattern rule as follows:
%.h %.c foo.h bar.h: foo.idl bar.idl %.dsc
idl package.dsc
But make fails with the following parser error:
makefile: *** mixed implicit and normal rules. Stop.
I tried converting to the following:
%.h %.c: foo.idl bar.idl %.dsc
idl package.dsc
foo.h bar.h: package.h
But this does not cover the case that one of the generated header
files is deleted nor does it support naming these files as a goal on the
command line.
Is there any other way to tell make to not build specified targets in
parallel? It sure would be nice if there was some syntax that would allow
one to group targets as being generated from a single rule (other than
via pattern rules).
Any help would be appreciated.
[Prev in Thread]
Current Thread
[Next in Thread]
multiple targets created by one command verses --jobs 2,
dave russo<=