make-alpha
[Top][All Lists]
Advanced

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

Proposed syntax for static make-also rule


From: Henning Makholm
Subject: Proposed syntax for static make-also rule
Date: Tue, 10 Dec 2002 20:20:42 +0100
User-agent: Mutt/1.4i

I've volunteered to add support for non-pattern rules that say that a
single command updates several files, to GNU make. Paul asked me to
let this list look at my proposed syntax before I start coding. So
here I am.

I propose that one can say

   target_a target_b target_c :& prereq_x prereq_y prereq_z ; COMMAND

meaning that COMMAND updates *all* targets when it is run once. As
for multi-target pattern rules (which already exhibit this behavior),
the automatic variables in COMMAND will be expanded according to the
target that happens to trigger the rule first; the user is responsible
for the results if this affects its behavior.

The ":&" syntax would generalize immediately to "::&" which would have
the double-colon nature as well as the also_make semantics.

In order to pretend that makefile syntax has any logic to it, I
further propose that

  %.foo %.bar :| %.baz ; COMMAND

be allowed as syntactic sugar for

  %.foo : %.baz ; COMMAND
  %.bar : %.baz ; COMMAND

and, further, that

  %.foo %.bar :& %.baz ; COMMAND
  foo bar :| baz ; COMMAND

have the same meanings as if the & and | had not been there. Then the
":" separator can be documented as a shorthand for either :& or :|,
depending on whether or not the rule is a pattern rule.

Risk assessment: Existing makefiles may break if the first character
of a dependency is & or | *and* they're written by a whitespace-phobic.
This is probably not a problem: Nobody in their right mind would use &
and | in filenames, as they are bourne-shell metacharacters and make
won't by itself attempt to quote or escape them.

However, existing makefiles that say

   TARGETS :| ORDER-ONLY-PREREQUISITES

would break slightly, too. This is more severe, though, there is
probably not many legacy makefiles that assume 3.80 yet, and in each
particular case it could be fixed by saying ": |" instead of ":|".

A possible alternative would be to use :- instead of what I call :| -
nobody in their right mind would want to begin a filename with a dash
either. But this would break the mnemonic symmetry between :& and :|.

Another alternative is to be less ambitious and only implement :&,
since that is the only feature that cannot be programmed with the
existing makefile syntax.

Comments, anyone?

-- 
Henning Makholm                                   "No one seems to know what
                                       distinguishes a bell from a whistle."



reply via email to

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