I have discovered a behavior that seems a bit odd; would appreciate thoughts on this:
* a rule with prerequisite file that doesn't exist: 'afile'
* an empty rule for 'afile'
=> target is never considered 'up to date'


It would seem to me that, since an empty rule is defined for 'afile', make should know that, since this prerequisite file does not exist and CANNOT be created, it cannot possibly make the target out of date, yet it does.

I want the prerequisite file to affect building target, only if it exists; otherwise target should be considered up to date.
How best to achieve this?
('afile' would be created manually, not by make.)


# Makefile

target: afile
        @echo 'building $@';\
        touch $@
        
afile:;
#eof

[EMAIL PROTECTED] junk]$ ls afile
ls: afile: No such file or directory
[EMAIL PROTECTED] junk]$ make target
building target
[EMAIL PROTECTED] junk]$ make target
building target
[EMAIL PROTECTED] junk]$ touch afile
[EMAIL PROTECTED] junk]$ make target
building target
[EMAIL PROTECTED] junk]$ make target
make: `target' is up to date.
[EMAIL PROTECTED] junk]$
- Greg Keraunen
http://www.xmake.org



_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to