help-gnu-utils
[Top][All Lists]
Advanced

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

Can make ignore timestamp of prerequisite?


From: william . knight
Subject: Can make ignore timestamp of prerequisite?
Date: 25 Feb 2006 15:35:13 -0800
User-agent: G2/0.2

I've got an obscure little problem in creating a Makefile which I can
solve with a hack, but I'd like to learn how to do it the right way. I
use a bunch of third-party libraries (TPL) in my project and I use a
Makefile to automatically build the libraries from their source tar
balls if needed. For convenience, I package the multiple source tar.gz
files into a single 'package' tar.gz. I then define some rules that say
if a source tar.gz file is not here, extract it from the package file:

lib1.tar.gz: package.tar.gz
     tar zxvf package.tar.gz

lib2.tar.gz: package.tar.gz
     tar zxvf package.tar.gz

(etc)

Now, I could have defined these rules WITHOUT using package.tar.gz as a
prerequisite, but I want it to be a dependency somewhere so I can issue
a message to the user if the file is not there AND it is actually
needed:

package.tar.gz:
     @echo File not found: $@
     @echo You can get it here: http://....
     exit 1

So these tar balls are dependent on the package file, but my problem is
that the package file always has a newer timestamp than the tar balls,
which it should. But this causes the tar extraction rule to always
fire, even if all the source tar balls are there. I don't want that. I
also don't want to 'touch' the package file date, I want it to have the
correct creation date. I can get around the problem by just listing the
package.tar.gz file as a pre-requisite of the 'all' target, but that is
not strictly correct, because then the Makefile would fail if the
package file was missing, even if all of the source tar balls were
present.

Any ideas on how to solve this?

thanks,

William Knight



reply via email to

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