help-make
[Top][All Lists]
Advanced

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

Re: a small question about subst


From: Ken Smith
Subject: Re: a small question about subst
Date: Thu, 12 May 2005 16:18:38 -0400
User-agent: Mutt/1.5.9i

Without seeing your code, I can only assume that you are trying to do
this in the command section of a rule.  If that is the case, you'll need
to use sed or something similar.  The GNU make functions will be
processed when the files are read and not when the targets are run.  At
that time, $< has no value and your statements evaluate to the empty
string.

Here is a simple example

my_root=root

file1.out: $(my_root)/folder1/file1
        @echo "modified prerequisite=\"`echo $< | sed -e 's/folder1\///'`\""

root/folder1/file1:
        mkdir -p $(@D)
        touch $(@)

  Ken

On Thu, May 12, 2005 at 02:09:48AM -0700, address@hidden wrote:
> Hi,
> I have a small question about subst in makefile
> script,
> 
> when $< is /root/folder1/file1
> I want to change it to /root/file1
> I try
> $(subst folder1/,,$<)
> $(subst folder1\/,,$<)
> and fail
> 
> Thanks for advise
> gan 
> 
> 
> 
>               
> __________________________________ 
> Yahoo! Mail Mobile 
> Take Yahoo! Mail with you! Check email on your mobile phone. 
> http://mobile.yahoo.com/learn/mail 
> 
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make




reply via email to

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