bug-make
[Top][All Lists]
Advanced

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

stripping leading ./ causes flaky results


From: Andrew Pimlott
Subject: stripping leading ./ causes flaky results
Date: Mon, 28 Feb 2005 16:26:18 -0800
User-agent: Mutt/1.5.6+20040907i

make is doing something funny in the area of stripping the leading ./
from filenames.  I can demonstrate with the following Makefile, which is
also attached so you get a copy without whitespace damage.

    files := $(shell find . -type f -print)
    objects: $(addprefix ./, $(files))
    install: $(addprefix /home/andrew/, $(files))
    $(addprefix /home/andrew/, $(files)): /home/andrew/%: ./%
            true $<

Put this in an empty directory, then create some files, eg

    for i in $(seq 1 10); do touch foo$i; done

and run

    make install

Output:

    true foo1
    true foo2
    true foo3
    true foo4
    true ./foo5
    true foo6
    true foo7
    true foo8
    true ./foo9
    true foo10
    true Makefile

Funny, huh?  I gave a little attempt to tracking it down.  I thought
maybe parse_file_seq was at fault, but it seems to give correct results.
Then, I looked at the output of

    make -r -p install

(attached).  Looking at the "Not a target" entries, I see foo5,
./foo5, and foo4, but no ./foo4.  So it seems that for some reason foo5
has an entry under both names and they are aliased in some way.  I can't
imagine why this only afflicts some files.

Also, I noticed that if I comment out the second line of the Makefiles
(which defines the unused objects target), the output is:

    true ./foo1
    true ./foo2
    true ./foo3
    true ./foo4
    true ./foo5
    true ./foo6
    true ./foo7
    true ./foo8
    true ./foo9
    true ./foo10
    true ./Makefile

This seems to be a mostly cosmetic bug, but the aliasing is somewhat
worrying.

My make is 3.80 in Debian GNU/Linux unstable.

Andrew

Attachment: Makefile
Description: Text document

Attachment: make_data_base
Description: Text document


reply via email to

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