logo       

Proposed syntax for static make-also rule: msg#00001

Subject: Proposed syntax for static make-also rule
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."


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    politics.lenini...    audio.emagic.ex...    tex.texinfo.gen...    handhelds.linux...    ietf.sipping/20...    lang.erlang.gen...    cygwin.talk/200...    yellowdog.gener...    mozilla.devel.l...    xfree86.newbie/...    openbsd.ports/2...    db.oracle.devel...    kde.kalyxo.deve...    user-groups.lin...    bbc.cvs/2003-04...    gnu.libtool.bug...    redhat.k12osn/2...    emulators.wine....    freebsd.devel.d...    search.xapian.g...    java.izpack.use...    network.mrtg.us...    windows.total-c...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe