tech-toolchain archive

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

Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)



On Mon, Dec 14, 2009 at 03:49:27AM -0500, der Mouse wrote:
 > Surely the right fix is not to add kludges like "nodes.h: nodes.c", but
 > rather to have make grow a syntax that _does_ mean "here are commands
 > which generate all of these files from these sources"?

Well, it does already mean that to some extent. Using multiple targets
on the left has ~always been used this way; it just breaks when
parallelized. (And other times too; see PR 34934.)

 > It's not perfect, but it seems better to me than declaring dependencies
 > which do not really exist (in this case, nodes.h does not actually
 > depend on nodes.c).

Right, and this can cause further problems, like always recompiling on
every build.

 > If we need a strawman syntax for it, I'll propose
 > 
 > target1 target2 ... :& dependency1 dependency2 ...
 >      ...commands as usual...

What about

target1 .AND target2: dep1 dep2 ...
        $(STUFF)

?

Note that this .AND is in a certain sense not actually different from
.WAIT.

 > This leads to issues with $@ and $(.TARGET), which I will propose
 > (again, as a total strawman) to deal with by saying that, in the
 > commands for a :& dependency, $@ and $(.TARGET) are not defined, and a
 > new local variable $(.TARGETS) is.

Binding $@ to the first target is the historical behavior and ought to
be sufficient, I think.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index