[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: conditional prerequisite
From: |
Alexander.Farber |
Subject: |
RE: conditional prerequisite |
Date: |
Mon, 31 Jan 2005 13:54:52 +0100 |
How about (untested):
info.h: info.txt
sed -f info.sed $< > $@
info.txt:
test -e info.h || wget -N http://blabla/info.txt -O $@
Regards
Alex
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf
> Of ext address@hidden
> Sent: Friday, January 28, 2005 6:09 PM
> To: address@hidden
> Subject: conditional prerequisite
>
>
> Hello,
>
> I had asked this before and Boris Kolpackov was so kind to give some
> hints. Unfortunately, they did not exactly address the problem and
> I'm trying to explain once more, hopefully better, what I'm trying
> to achieve:
>
> I have the following two rules.
>
> info.h: info.txt
> sed -f info.sed info.txt > info.h
>
> info.txt:
> wget -N http://blabla/info.txt
>
> The purpose is:
> * The dependency of info.h from info.txt extracts compilable
> information from a data source.
> * The rule for info.txt would retrieve that data source from
> the Internet.
> -> However, I only want the second rule (wget) to be executed if the
> first target needs to be built (info.h does not exist).
> If info.h already exists, I want the wget to be suppressed.
> If info.h does not exist, I want wget to retrieve info.txt so
> that info.h can be generated.
> (As a side-case, if info.txt does exist AND is newer than info.h,
> it would be reasonable to regenerate info.h as well, but actually
> that is of minor importance.)
> The reason is that in a production environment, I cannot assume
> that Internet access is always available (or fast enough, as the
> files are quite large). So downloading should only be triggered if
> unavoidable.
> (For an explicit update, another target might delete info.h, or
> might activate the info.txt rule explicitly.)
>
> The intended behaviour in detail is:
>
> info.h is newer than info.txt:
> nothing happens
>
> info.h is older than info.txt:
> sed is invoked
>
> info.h exists but info.txt does not exist:
> nothing happens!
>
> info.h does not exist but info.txt exists:
> sed is invoked
>
> info.h and info.txt both do not exist:
> wget is invoked, then sed
>
> Is this possible?
>
> Thanks and kind regards,
> Thomas Wolff
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
>