Sat 31 Dec 2005 04:00:34 PM UTC, original submission:
[Please retain the CC to -unavailable- so that the Debian Bug Tracking system can record your input]
This has been reported by a debian user.
There seems to be a strange interaction with the "-W <file>" option when it is used in conjunction with the VPATH feature of make.
Firstly, here is an excerpt from the make info manual,
`-W FILE'
`--what-if=FILE'
`--new-file=FILE'
`--assume-new=FILE'
Pretend that the target FILE has just been modified. When used with the `-n' flag, this shows you what would happen if you were to modify that file. Without `-n', it is almost the same as running a `touch' command on the given file before running `make', except that the modification time is changed only in the imagination of `make'.
Now, an annotated typescript that demonstrates the problem,
1. !139, 140, 141, 142 - here is the situation, "a" depends on "b", however, "b" only exists as "./b-dir/b", while "a" exists only in the directory from which make is being run. As you can see, "a" is up to date.
139 jeff /tmp $ echo .{,/b-dir}/{a,b}
./a ./b ./b-dir/a ./b-dir/b
140 jeff /tmp $ ls -l .{,/b-dir}/{a,b}
ls: ./b: No such file or directory
ls: ./b-dir/a: No such file or directory
-rw-rw-r-- 1 jeff root 0 Aug 3 14:29 ./a
-rw-rw-r-- 1 jeff root 0 Aug 3 14:29 ./b-dir/b
--> exit status 1
141 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n'
a: b
cp $(<) $(@)
142 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f\
/dev/stdin VPATH=b-dir
make: `a' is up to date.
2. !143, 144, 145 - I maintain that make should behave identically at both !143 and !144-145, ie, at !143, "a" should have been re-made.
143 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
/dev/stdin VPATH=b-dir -W ./b-dir/b
make: `a' is up to date.
144 jeff /tmp $ touch ./b-dir/b
145 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
/dev/stdin VPATH=b-dir
cp b-dir/b a
3. !146, 147, 148 - here make behaves correctly at !146 and !147, however, the behavior at !148 is problematic, IMO. Since VPATH is in effect, make should pretend that the first "b" that it finds in the VPATH has just been modified, instead make ignores VPATH entirely, and considers "b", ie, "./b" as the prerequisite for "a".
One could argue here that "-W b" means "-W ./b", thus make is behaving correctly at !148, however, such an interpretation makes it very difficult to use "-W <file>" along with VPATH and forces the user to know exactly where VPATH would have found <pathname-to-file> in order for her to specify it as "-W <pathname-to-file>".
146 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
/dev/stdin VPATH=b-dir
make: `a' is up to date.
147 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
/dev/stdin VPATH=b-dir -W ./b
cp b a
cp: cannot stat `b': No such file or directory
make: *** [a] Error 1
--> exit status 2
148 jeff /tmp $ printf '%b' 'a: b\n\tcp $(<) $(@)\n' | make -f \
/dev/stdin VPATH=b-dir -W b
cp b a
cp: cannot stat `b': No such file or directory
make: *** [a] Error 1
--> exit status 2
|