VPATH: Search Path for All Dependencies
The value of the
VPATH specifies a list of
make should search. Most often, the
directories are expected to contain dependency files that are not in the
current directory; however,
VPATH specifies a search list that
make applies for all files, including files which are targets of
Thus, if a file that is listed as a target or dependency does not exist
in the current directory,
make searches the directories listed in
VPATH for a file with that name. If a file is found in one of
them, that file becomes the dependency. Rules may then specify the
names of source files in the dependencies as if they all existed in the
current directory. See section Writing Shell Commands with Directory Search.
VPATH variable, directory names are separated by colons or
blanks. The order in which directories are listed is the order followed
make in its search.
VPATH = src:../headers
specifies a path containing two directories, `src' and
make searches in that order.
With this value of
VPATH, the following rule,
foo.o : foo.c
is interpreted as if it were written like this:
foo.o : src/foo.c
assuming the file `foo.c' does not exist in the current directory but is found in the directory `src'.
Go to the first, previous, next, last section, table of contents.