help-make
[Top][All Lists]
Advanced

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

Re: Pattern rule prereqs are variables with % in them


From: Boris Kolpackov
Subject: Re: Pattern rule prereqs are variables with % in them
Date: Wed, 7 Sep 2005 14:30:11 +0200
User-agent: Mutt/1.5.6+20040907i

Paul D. Smith <address@hidden> writes:

>   bk> all: /tmp/foo.x
>
>   bk> foo_OBJS = foo.o bar.o
>
>   bk> %.x: $$(%_OBJS)
>
>   bk> The result of $$(%_OBJS) will be '/tmp/foo.o /tmp/bar.o'.
>
> Eh?  Really?!?!  The path munging is applied to the CONTENTS of the
> variable?  That seems pretty... strange...

That seemed like the most natural way to go when I implemented it.
Here is the comment from implicit.c:

/* In an ideal world we would take the dependency line,
   substitute the stem, re-expand the whole line and
   chop it into individual prerequisites. Unfortunately
   this won't work because of the "check_lastslash" twist.
   Instead, we will have to go word by word, taking $()'s
   into account, for each word we will substitute the stem,
   re-expand, chop it up, and, if check_lastslash != 0,
   add the directory part to each resulting prerequisite.  */

In other words, anything that had % in it will have directory
added to each word after the expansion. Ironically, in the example
above, this logic works quite well, don't you find? Also note
that one can always opt-out of this by using $$* instead of %.

hth,
-boris

Attachment: signature.asc
Description: Digital signature


reply via email to

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