vpath issue - not getting what i assumed

145 Views Asked by At

I have vpath set as follows:

vpath %.cpp $(SRC)

Now if i want to get the list of object files to be created, should it not work with the following ?

COBJS=$(patsubst %.cpp,%.o,$(wildcard *.cpp))

It is not. I am not getting any list of files when i run the command

make --just-print

It only shows the list of object files if i do the following :

COBJS=$(patsubst %.cpp,%.o,$(wildcard $(SRC)/*.cpp))

Any explanation?

1

There are 1 best solutions below

0
Beta On

The vpath directive will tell Make where to look for prerequisites of rules. It will have no effect on where the wildcard directive looks for files-- which is a good thing.