One reason I can think to add the "include" directory (for .h
files) to the vpath
would be for dependency checking.
Your .c
files should depend on all of the .h
files they include - so if you change a header file, all compilation units that include that might be affected are re-built.
Lets say you have a src/
directory for all of your .c
files, and an include/
directory for all of your .h
files. By using vpath
for include/
, and adding a -I
include path for g++
, you can simply refer to all the header files by name (in the Makefile), and not have to be concerned with their paths.