[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conditional prerequisite
From: |
Paul D. Smith |
Subject: |
Re: conditional prerequisite |
Date: |
Fri, 28 Jan 2005 12:59:51 -0500 |
%% address@hidden writes:
tw> info.h: info.txt
tw> sed -f info.sed info.txt > info.h
tw> info.txt:
tw> wget -N http://blabla/info.txt
tw> The intended behaviour in detail is:
tw> info.h is newer than info.txt:
tw> nothing happens
tw> info.h is older than info.txt:
tw> sed is invoked
tw> info.h exists but info.txt does not exist:
tw> nothing happens!
tw> info.h does not exist but info.txt exists:
tw> sed is invoked
tw> info.h and info.txt both do not exist:
tw> wget is invoked, then sed
tw> Is this possible?
To do this you'll need to be tricky, because you want to know what the
state of the directory is before any rules are invoked; you can find
that out like this:
FILES := $(wildcard info.h info.txt)
Now you can check which ones existed. So for example, if you only
wanted to run the wget if neither existed, you could do something like
this (there are obviously many ways to do it):
info.txt:
ifndef FILES
wget -N http://blabla/info.txt
endif
or whatever.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist