Just noticed my colleague has posted the same topic over the
web-interface (subject: [bug #33499] VPATH does not work with 'Advanced
Auto-DependencyGeneration' when source file is moved into another
location).
Sorry for this spam.
-----Original Message-----
From: bug-make-bounces+joachim.bauernberger.ext=nsn....@gnu.org
[mailto:bug-make-bounces+joachim.bauernberger.ext=nsn....@gnu.org] On
Behalf Of Bauernberger, Joachim (EXT-Other - DE/Ulm)
Sent: Wednesday, June 08, 2011 9:25 PM
To: bug-make@gnu.org
Subject: RE: VPATH file rename is not detected by $<
Sorry line wrapping broke the test case bbelow. Hope it's ok to attach
it once more.
Cheers,
joachim
-----Original Message-----
From: bug-make-bounces+joachim.bauernberger.ext=nsn....@gnu.org
[mailto:bug-make-bounces+joachim.bauernberger.ext=nsn....@gnu.org] On
Behalf Of Bauernberger, Joachim (EXT-Other - DE/Ulm)
Sent: Wednesday, June 08, 2011 9:10 PM
To: bug-make@gnu.org
Subject: VPATH file rename is not detected by $<
Hi,
sorry for the bother, I checked the archives but have not found an
answer.
If there is already a solution please kindly point me to it.
Here is the situation: If a source file is renamed and moved from one
VPATH to another then $< still points to the old (previous) path. It
detects that it no longer exists at the previous location but $< is
still pointing to it.
Please consider the attached minimalistic test case. It creates a
directory called test/ in your CWD (and removes it if already present so
please beware before running it)
Cheers,
Joachim
8<---------SNIP---------8<---------SNIP---------8<---------SNIP---------
#!/bin/bash
rm -rf test
mkdir -p test/src/a test/src/b test/res
cat > test/src/a/foo.c <<'EOF'
#include <stdio.h>
int main() {
printf("CMD\n");
return 0;
}
EOF
cat > test/Makefile <<'EOF'
all: foo
VPATH = src/a src/b res
foo: res/foo.o
$(CC) -o $@ $<
res/%.o: %.c
$(info found $<, actual $(wildcard src/*/*.c))
$(CC) -o $@ -c $< -Wp,-MD,$@.d; \
perl -ne 'print $$_; $$_ =~ s/.*: //; push @a, $$_; END {
$$a[-1] =~ s/$$/ :/; print join("", @a, ); }' $@.d > $@.d.cmd
include $(wildcard res/*.d.cmd)
EOF
cat > test/mine.out <<EOF
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-redhat-linux-gnu
First build works
found src/a/foo.c, actual src/a/foo.c
cc -o res/foo.o -c src/a/foo.c -Wp,-MD,res/foo.o.d; \
perl -ne 'print $_; $_ =~ s/.*: //; push @a, $_; END { $a[-1]
=~ s/$/ :/; print join("", @a, ); }' res/foo.o.d > res/foo.o.d.cmd
cc -o foo res/foo.o
mv src/a/foo.c src/b/foo.c
Second build fails
found src/a/foo.c, actual src/b/foo.c
cc -o res/foo.o -c src/a/foo.c -Wp,-MD,res/foo.o.d; \
perl -ne 'print $_; $_ =~ s/.*: //; push @a, $_; END { $a[-1]
=~ s/$/ :/; print join("", @a, ); }' res/foo.o.d > res/foo.o.d.cmd
cc: src/a/foo.c: No such file or directory
cc: no input files
EOF
cd test
make --version
echo
echo -------------------------------------------- First build works
echo
make
echo
echo -------------------------------------------- mv src/a/foo.c
src/b/foo.c
echo
mv src/a/foo.c src/b/foo.c
echo -------------------------------------------- Second build fails
echo
make
echo
echo -------------------------------------------- Please compare your
results with mine in test/mine.out
echo
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make
--- Begin Message ---
URL:
<http://savannah.gnu.org/bugs/?33499>
Summary: VPATH does not work with 'Advanced Auto-Dependency
Generation' when source file is moved into another location
Project: make
Submitted by: None
Submitted on: Thu 09 Jun 2011 06:14:55 AM UTC
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: 3.81
Operating System: POSIX-Based
Fixed Release: None
Triage Status: None
_______________________________________________________
Details:
I am using 'Advanced Auto-Dependency Generation' described at
http://make.paulandlesley.org/autodep.html together with VPATH.
When source file is moved from one location in VPATH into another one (usual
situation in our project), make still try to use a source file in old
location.
I created a script (attached) to illustrate a problem.
Output on my host:
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i686-pc-linux-gnu
-------------------------------------------- First build works
found src/a/foo.c, actual src/a/foo.c
cc -c -MD -o foo.o src/a/foo.c
cc -o foo foo.o
make: Nothing to be done for `all'.
-------------------------------------------- mv src/a/foo.c src/b/foo.c
-------------------------------------------- Second build fails
found src/a/foo.c, actual src/b/foo.c
cc -c -MD -o foo.o src/a/foo.c
cc: src/a/foo.c: No such file or directory
cc: no input files
make: *** [foo.o] Error 1
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Thu 09 Jun 2011 06:14:55 AM UTC Name: err_in_dep.sh Size: 2kB By:
None
<http://savannah.gnu.org/bugs/download.php?file_id=23510>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33499>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make
--- End Message ---
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make