[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Canonical filenames in targets and dependencies
From: |
Jeffrey Butler |
Subject: |
Canonical filenames in targets and dependencies |
Date: |
Mon, 19 Mar 2001 14:09:27 -0800 (PST) |
Hi,
I think I've found a bug in make. This potential
problem has to do with reducing dependency files to
canonical names. In other words, make treats a
filename './mydir/myfile' as not equivalent to a file
'./mydir/./myfile' while the filesystem considers
these two paths to be equivalent. I'm not sure if
make should reduce the dependency and target names to
a canonical format,but it appears that make is not
currently doing a reduction. I think this problem
generalizes to cases where a path contains '..' but
then decends back down into a directory
(./mydir/../mydir/myfile == ./mydir/myfile)
I tested this under Linux (Linux <myhost> 2.4.1 #1
Thu Feb 15 13:20:11 EST 2001 i686 unknown) with make
version 3.79.1
Consider the following makefile:
Makefile 1::
.PHONY:all
all:: foo
dog:
touch dog
foodir/bar: dog
rm -rf foodir
mkdir foodir
touch foodir/bar
foo: ./foodir/./bar
touch foo
clean:
rm -f foo bar
rm -rf foodir
-- end makefile --
Do the following:
1 $ make
make: *** No rule to make target `foodir/./bar',
needed by `foo'. Stop.
Change the line 'foo: ./foodir/./bar' to 'foo:
foodir/bar'
Makefile 2::
.PHONY:all
all:: foo
dog:
touch dog
foodir/bar: dog
rm -rf foodir
mkdir foodir
touch foodir/bar
foo: foodir/bar
touch foo
clean:
rm -f foo bar
rm -rf foodir
-- end makefile 2 --
2 $ make
touch dog
rm -rf foodir
mkdir foodir
touch foodir/bar
touch foo
This test seems to show that make does not treat
'foodir/bar' as equivalent to 'foodir/./bar' when it
appears in dependency lists.
As another test I changed the line 'foodir/bar: dog'
to './foodir/./bar' and left the dependency list as
the original path.
Makefile 3::
.PHONY:all
all:: foo
dog:
touch dog
./foodir/./bar: dog
rm -rf foodir
mkdir foodir
touch foodir/bar
foo: foodir/bar
touch foo
clean:
rm -f foo bar
rm -rf foodir
-- end makefile 3 --
3 $ make clean
4 $ make
make: *** No rule to make target `foodir/bar', needed
by `foo'. Stop.
So this also seems to be a problem with targets.
For a final test I changes both the target and the
dependency:
Makefile 4::
.PHONY:all
all:: foo
dog:
touch dog
./foodir/./bar: dog
rm -rf foodir
mkdir foodir
touch foodir/bar
foo: ./foodir/./bar
touch foo
clean:
rm -f foo bar
rm -rf foodir
-- end makefile 4 --
5 % make
rm -rf foodir
mkdir foodir
touch foodir/bar
touch foo
And now it seems to work again. Again, I'm not sure
what the 'correct' behavior is, but it would be nice
matched targets and dependencies on more than just a
string comparison.
thanks,
-jeff
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Canonical filenames in targets and dependencies,
Jeffrey Butler <=