help-make
[Top][All Lists]
Advanced

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

Re: about subst


From: Lin George
Subject: Re: about subst
Date: Tue, 29 Aug 2006 01:18:55 -0700 (PDT)

Thank you for your reply!


Your answer has answered all of my questions. Cool!


regards,
George


Message: 3
Date: Mon, 28 Aug 2006 10:16:23 +0200
From: "Danny Boelens" <address@hidden>
Subject: Re: about subst
To: <address@hidden>
Message-ID:
<address@hidden>
Content-Type: text/plain;       charset="iso-8859-1"


----- Original Message ----- 
From: "Lin George" <address@hidden>
To: <address@hidden>
Sent: Sunday, August 27, 2006 2:18 PM
Subject: about subst


> Foo:
>     rm $(subst /,\,$@)
>
> Could anyone tell me what means $(subst /,\,$@)?
Which
> page in the make manual covers this point?

There are multiple pages covering this single line.

First of all, this is a rule for Foo, the target, and
the rule has no
prerequisites, only commands. See Chapter 4, Writing
Rules.

Then we have the subst function (see 8.2 Functions for
String 
Substitution
and Analysis) which is used as argument for rm. And
just in case: rm is 
the
unix command to remove files are directories. Since
the syntax is 
$(subst
fro, to, something) it is clear that this will replace
forward slashes 
(/)
by backward slashes (\) in something ($@ in this
case).

And finally we have $@, which is the file name of the
target of the 
rule (or
the name of the archive file is the target is an
archive member). See 
10.5.3
Automatic Variables.

In your example the subst isn't doing much as there
are no forward 
slashes
in your target. To give a better example:

some/dir/with/foo :
    rm $(subst /,\,$@)

is a rule for some/dir/with/foo, and when its commands
are executed it 
will
(try to) remove some\dir\with\foo.

Hope this helps,
Danny

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

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