VPATH in makefile

I've source files in different directories.
Therefore I should use VPATH in the makefile for compiling all together.

But it does not work. It simply does not look into VPATH and compiles only the cpp files in the directory where I launch "make".

I don't see what's wrong with this makefile. Any hint, please?

1
2
3
4
5
6
7
8
9
10
11
12
CPP = g++ -g -Wall
VPATH = /home/CPractice/Repository

files_hpp = $(wildcard *.h)
files_cpp = $(wildcard *.cpp)

main: volcalc.exe

volcalc.exe: $(files_cpp) $(files_hpp)
        $(CPP) $(files_cpp) -o volcalc.exe
clean:
        @rm -f volcalc.exe
Are you expecting lines 4 & 5 to pay attention to VPATH? The wildcard function won't do that. Those variables will only contain the files that match those wildcards in the CWD.
Topic archived. No new replies allowed.