bug-make
[Top][All Lists]
Advanced

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

[bug #19122] $* doesn't work as expected


From: anonymous
Subject: [bug #19122] $* doesn't work as expected
Date: Thu, 22 Feb 2007 09:25:44 +0000
User-agent: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.0.5) Gecko/20060902 Firefox/1.5.0.5

Follow-up Comment #1, bug #19122 (project make):

It's behaving exactly as described in the GNU make info pages.  In
particular, as described in section 10.5.3 "Automatic Variables":

`$*'
     The stem with which an implicit rule matches (*note How
     Patterns Match: Pattern Match.).  If the target is
     dir/a.foo.b' and the target pattern is `a.%.b' then the
     stem is `dir/foo'.  The stem is useful for constructing
     names of related files.
<...>
     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.

The rule in your example is an explicit rule and the target is not in the
default suffix list.  Therefore $* will be empty in that rule.  As mentioned
in the text above, use of $* in explicit rules is discouraged.  You should
either
a) hardcode the stem for the rule (there's only one target
   in your example, so there's only one stem),
b) extract the correct stem for the the target using $(patsubst)
   against $@, or whatever is appropriate, OR
c) add ".bin" to the suffix list by naming .bin as a dependency
   of the .SUFFIXES pseudo-target.


Philip Guenther


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?19122>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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