help-make
[Top][All Lists]
Advanced

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

Re: Can I defer make-var expansion until a command is executed


From: Chen Jun (陈军)
Subject: Re: Can I defer make-var expansion until a command is executed
Date: Mon, 04 Aug 2008 12:46:41 +0800
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

Brian Dessent wrote:
Chen Jun  wrote:

How can I do it? I know I can add another rule to accomplish that, e.g.

Why do you even need $(shell ...) here?  All the commands in the recipe
are implicitly evaluated by the shell, so just do your conditional there:

outfile = out.txt

$(outfile):
        @echo -n "STRT: $@ "; if [ -f $@ ]; then echo exist; else echo absent; 
fi
        @touch $@
        @echo -n "DONE: $@ "; if [ -f $@ ]; then echo exist; else echo absent; 
fi

Brian

Well Brian, the example presented by me is just a fabricated one, not for my real world use. I use $(shell ) just to introduce a make variable or a make function so that my question becomes concrete. My real world case regarding this problem is quite a bit complex so I'd like not to talk about to it directly.


Attachment: chenjun.vcf
Description: Vcard


reply via email to

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