help-make
[Top][All Lists]
Advanced

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

Re: non-existent prerequisite w/ empty rule makes target out of date


From: Robert Mecklenburg
Subject: Re: non-existent prerequisite w/ empty rule makes target out of date
Date: Thu, 17 Jul 2003 09:13:44 -0600

----- Original Message ----- 
"Paul D. Smith" <address@hidden> writes:
> %% gk <address@hidden> writes:
>
>   g> I have discovered a behavior that seems a bit odd; would appreciate
>   g> thoughts on this:
>   g> * a rule with prerequisite file that doesn't exist: 'afile'
>   g> * an empty rule for 'afile'
>   g> => target is never considered 'up to date'
>
> Yes.

>   g> I want the prerequisite file to affect building target, only if it
>   g> exists; otherwise target should be considered up to date.
>   g> How best to achieve this?
>
> You can't.

Excuse me for jumping in a month late on this message but wouldn't something
like this work:

target: $(if $(wildcard possible-prereq),possible-prereq)
        actions...

That is, if the file possible-prereq exists, include it as a prerequisite,
otherwise omit the file.  It seems like this does what gk wants.  Or have I
misunderstood something?

Cheers,
Robert





reply via email to

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