Bernhard Voelker wrote:

> On September 10, 2012 at 1:41 PM Jim Meyering <j...@meyering.net> wrote:
>
>> I want each *existing* .1 file to depend solely on its corresponding .c file.
>> However, when a .1 file does not exist, *then* I want it to depend on
>> its corresponding executable.
>> I.e., I do *not* want to rebuild an existing .1 file
>> solely because we have a newer binary, when the .1 file
>> is newer than its dependents (.c and .version).
>> I started work on a prefix to the .x.1 rule in man/local.mk,
>> but it relies on test's -nt operator.  With a shell lacking
>> that feature, or when things are out of date, the regular commands
>> would run.  Otherwise, it would simply touch the .1 file and exit
>> successfully.
>>
>> AFAIK, there is no way in GNU make to specify dependencies that vary
>> depending on the existence of a target.  Does anyone know otherwise?
>> I.e., a rule that would apply when foo.1 does not exist, vs. another
>> one (with different dependents) that would apply when it does exist.
>
> Not sure, but maybe something for .SECONDARYEXPANSION ?
> http://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html#Secondary-Expansion
> <http://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html#Secondary-Expansion>

Thanks!  That looks promising, i.e,. to make the second expansion
depend on the existence of $@.  If it works as I'm imagining, it
would be cleaner than having to create an if-else block per target.

Filing that away for the day we can rely on GNU make.

Reply via email to