Hi,
I have a problem with VPATH and prerequisites.
Imagine the following structure:
- file1.cpp
- dir1
- file2.cpp
"Makefile" in the root directory looks like this:
VPATH = dir1
file: file1.o file2.o
file1.o: file1.cpp
"Makefile" in the "dir1" directory looks like this:
file2.o: file2.cpp
After I run "make" in "dir1", I will have "file2.o" file in "dir1".
When I run "make" in the root dirctory, "make" creates the "file2.o"
also in the root directory (it recompiles "file2").
This happends because "make" considers the "file2.o" rule from
"dir1/Makefile".
How should I write this in order to stop this from happending?
I would like to keep the general structure as the project is quite large.
I tried to change "file" rule in "Makefile" of the root directory to:
file: file1.o dir1/file2.o
but "make" returns an error:
No rule to make target 'dir1/file2.o', needed by 'file1'
Thanks a lot,
Ray
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make