[Top][All Lists]

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

[bug #59399] Expanding implicit macros in gmake (enhancement request)

From: Paul D. Smith
Subject: [bug #59399] Expanding implicit macros in gmake (enhancement request)
Date: Sun, 29 Nov 2020 18:30:07 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

Follow-up Comment #4, bug #59399 (project make):

As always I'm ignoring as irrelevant who implemented what first.

Using $< is very trivial.  It always expands to the first prerequisite in the
rule that contains the recipe.  That's true for double-colon rules as well of
course.  For example:

all: foo bar

foo: blah

foo: biz; : $<

bar:: boz yadda; : $<
bar:: baz yadda; : $<

biz boz baz blah yadda: ;@:

will print:

: biz
: boz
: baz

Using $* is more complicated but the GNU make manual describes it pretty well
I think:


     In an explicit rule, there is no stem; so '$*' cannot be determined
     in that way.  Instead, if the target name ends with a recognized
     suffix (*note Old-Fashioned Suffix Rules: Suffix Rules.), '$*' is
     set to the target name minus the suffix.  For example, if the
     target name is 'foo.c', then '$*' is set to 'foo', since '.c' is a
     suffix.  GNU 'make' does this bizarre thing only for compatibility
     with other implementations of 'make'.  You should generally avoid
     using '$*' except in implicit rules or static pattern rules.

     If the target name in an explicit rule does not end with a
     recognized suffix, '$*' is set to the empty string for that rule.

This text has not been changed since Roland's 1992 version of the manual.


Reply to this item at:


  Message sent via Savannah

reply via email to

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