[OpenAFS-devel] avoiding make rules with multiple targets

Michael Meffie mmeffie@sinenomine.net
Wed, 20 Feb 2013 11:33:57 -0500


On Tue, 19 Feb 2013 19:10:21 -0500
Benjamin Kaduk <kaduk@MIT.EDU> wrote:

> We've had a few commits over the years to help parallel builds along by 
> splitting rules with two targets into two separate rules, one a pure 
> dependency and the other with the actual contents of the rule (usually 
> compile_et).
> 
> A typical example is 147aeeb6c59b5f4a9f8a795a91e0c42ecf80278c 
> (gerrit/257) (trimmed):
> -budb_errs.c budb_client.h: budb_errs.et budb_client.p.h
> +budb_client.h: budb_errs.c
> +
> +budb_errs.c: budb_errs.et budb_client.p.h
>          $(RM) -f budb_client.h budb_errs.c; ${COMPILE_ET} -p ${srcdir} budb_errs -h budb_client
> 
> However, these changes seem to cause problems for FreeBSD make, even for 
> serial builds.  The build log shows a failure to install budb_client.h , 
> No such file or directory, but then continues on to compile linktest 
> before bailing out (sorry for the poorly wrapped copy/paste):

This can be a problem in linux as well, using gnu/make, and is not limited
to bu*.

<snip>

> The problem seems to stem from there being two calls to compile_et using 
> budb_errs.et, one of which makes budb_errs.h and the other which makes 
> budb_client.h.  Swapping the order in which the multiple targets are split 
> out, so that budb_errs.c depends on budb_client.h which is made via 
> compile_et, lets my build finish here, but it's probably not the best 
> solution.
> 
> Is there reason to not make a budb_client.h that is the contents of 
> budb_client.p.h with #include <budb_errs.h> added?  Alternately we could 
> process the template manually with the shell.

I had started making some changes to compile_et, so I could change the
depencencies in the makefiles, and posted that as gerrit 7921. But I'm
worried that approach would not work if people used a different compile_et.


-- 
Michael Meffie <mmeffie@sinenomine.net>