help-make
[Top][All Lists]
Advanced

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

is it possible to have a prerequisite, which, when non-existent, causes


From: Mark Galeck (CW)
Subject: is it possible to have a prerequisite, which, when non-existent, causes make to ignore it?
Date: Sun, 15 Nov 2009 16:36:47 -0800

I want to have a prerequisite file, which may or may not exist.  If it exists, 
I want make to behave as normal.  If it does not exist, I want make to ignore 
that prerequisite.  

Is it possible?

--------------------

I tried

foobar:  foo
        touch foobar

foo: 

but here if foo does not exist, then make " imagines this target to have been 
updated whenever its rule is run. This implies that all targets depending on 
this one will always have their commands run." (from the manual).  

So this is not exactly what I want, I want that foobar command is not run when 
foo does not exist.  

---------------------------

Background:  this would give a me an elegant solution to the auto-dependency, 
without a "hole" that I mentioned recently

Mark




reply via email to

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