[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conditional prerequisite
From: |
John Graham-Cumming |
Subject: |
Re: conditional prerequisite |
Date: |
Fri, 28 Jan 2005 13:11:28 -0500 |
On Fri, 2005-01-28 at 12:09, address@hidden wrote:
> 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
[snip]
I made a little example Makefile like this:
info.h: info.txt
touch info.h
info.txt: info.marker
touch info.txt
info.marker:
touch info.marker
.INTERMEDIATE: info.txt
The first time you run this you'll get
touch info.marker
touch info.txt
touch info.h
rm info.txt
> info.h is newer than info.txt:
> nothing happens
If you touch info.h then nothing happens.
make: `info.h' is up to date.
> info.h is older than info.txt:
> sed is invoked
touch info.h ; sleep 1 ; touch info.txt then you'll get the output:
touch info.h
> info.h exists but info.txt does not exist:
> nothing happens!
rm info.txt and then you'll get the output:
make: `info.h' is up to date.
> info.h does not exist but info.txt exists:
> sed is invoked
rm info.h ; touch info.txt then you'll get
touch info.h
> info.h and info.txt both do not exist:
> wget is invoked, then sed
rm info.h info.txt and then you'll get
touch info.txt
touch info.h
rm info.txt
Basically the info.marker is acting as the driver for this build. If
you touch it/remove it you'll force everything to be remade. info.txt
is marked intermediate so it only gets rebuilt if GNU Make needs to make
it to make info.h and it wont make info.txt just because it's missing,
that'll only happen if it builds info.marker or info.marker is newer
than info.h. Naturally you would change my 'touch' commands for info.h
and info.txt into your sed/wget.
John.
--
John Graham-Cumming
Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/