osdir.com
mailing list archive

Subject: Can make ignore timestamp of prerequisite? - msg#00000

List: gnu.utils

Date: Next Index Thread: Next Index
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


Was this page helpful?
Yes No
Thread at a glance:

Next Message by Date: click to view message preview

Re: Can make ignore timestamp of prerequisite?

To clarify and summarize what I'm asking, I want to somehow define a rule where the commands are executed ONLY if the target does not exist. I want to prevent the rule from being applied when the prerequisite is simpy newer than the target.

Next Message by Thread: click to view message preview

Re: Can make ignore timestamp of prerequisite?

To clarify and summarize what I'm asking, I want to somehow define a rule where the commands are executed ONLY if the target does not exist. I want to prevent the rule from being applied when the prerequisite is simpy newer than the target.
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by