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: John Graham-Cumming
Subject: Re: a small question about subst
Date: Thu, 12 May 2005 16:04:31 -0400

On Thu, 2005-05-12 at 02:09 -0700, address@hidden wrote:
> when $< is /root/folder1/file1
> I want to change it to /root/file1
> I try
> $(subst folder1/,,$<)
> $(subst folder1\/,,$<)
> and fail

So $(subst) is a function: i.e. it takes some inputs and returns an
output string.   You cannot set $< in a Makefile because it is an
automatic variable, but you can apply a function to it and use the
result in your Makefile.

So for example, $(subst folder1/,,$<) will act on $< and remove folder1
from the string that is in $< and the value of the entire $(subst ...)
will be the value of $< with folder1/ removed.

John.






reply via email to

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