make: General Search

1 
1 4.5.1 'VPATH': Search Path for All Prerequisites
1 ------------------------------------------------
1 
1 The value of the 'make' variable 'VPATH' specifies a list of directories
1 that 'make' should search.  Most often, the directories are expected to
1 contain prerequisite files that are not in the current directory;
1 however, 'make' uses 'VPATH' as a search list for both prerequisites and
1 targets of rules.
1 
1    Thus, if a file that is listed as a target or prerequisite does not
1 exist in the current directory, 'make' searches the directories listed
1 in 'VPATH' for a file with that name.  If a file is found in one of
1 them, that file may become the prerequisite (see below).  Rules may then
1 specify the names of files in the prerequisite list as if they all
11 existed in the current directory.  ⇒Writing Recipes with Directory
 Search Recipes/Search.
1 
1    In the 'VPATH' variable, directory names are separated by colons or
1 blanks.  The order in which directories are listed is the order followed
1 by 'make' in its search.  (On MS-DOS and MS-Windows, semi-colons are
1 used as separators of directory names in 'VPATH', since the colon can be
1 used in the pathname itself, after the drive letter.)
1 
1    For example,
1 
1      VPATH = src:../headers
1 
1 specifies a path containing two directories, 'src' and '../headers',
1 which 'make' searches in that order.
1 
1    With this value of 'VPATH', the following rule,
1 
1      foo.o : foo.c
1 
1 is interpreted as if it were written like this:
1 
1      foo.o : src/foo.c
1 
1 assuming the file 'foo.c' does not exist in the current directory but is
1 found in the directory 'src'.
1