autoconf
[Top][All Lists]
Advanced

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

Re: is $* the complete path?


From: Paul D. Smith
Subject: Re: is $* the complete path?
Date: 15 Dec 2000 02:37:42 -0500
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

%% Assar Westerlund <address@hidden> writes:

  >> The $* variable always expands to the entire part of the target filename
  >> which _doesn't_ match the suffix.

  aw> Weird.  I had the following case (hopefully these parts of the
  aw> Makefile are enough), from autoconf's man/Makefile.am:

  aw> srcdir = /a/long/path/man
  aw> top_srcdir = /a/long/path
  aw> VPATH = /a/long/path/man

  aw> top_builddir = ..

  aw> .x.1:
  aw>         if test -f $(top_builddir)/$*; then \
  aw>         ...

  aw> and I was getting:

  aw> if test -f ..//a/long/path/man/autoconf; then \

  aw> Since the target should have been "autoconf.1", I don't see why the
  aw> vpath gets added to $* ?

Because the target _is_ the VPATH-expanded name, by the time the command
script is evaluated.  That's how VPATH works: the names of the target
and prerequisites are expanded to be their VPATH versions if they are
found, and the automatic variables ($@, $*, $<, $^, etc.) are set using
those expanded values.

Since VPATH doesn't change the command script contents directly,
automatic variables are the _only_ way the command script can use VPATH
pathnames at all.

That's one major reason why VPATH is essentially useless in most SysV
and at least earlier BSD makes: most of these makes don't allow the use
of (most) automatic variables in explicit rules; they're only allowed in
implicit rules.  Stupid, but...

  aw> And is using basename a reasonably solution in this case?

I think it is.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



reply via email to

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