Directory search applies in a special way to libraries used with the linker. This special feature comes into play when you write a dependency whose name is of the form `-lname'. (You can tell something strange is going on here because the dependency is normally the name of a file, and the file name of the library looks like `libname.a', not like `-lname'.)
When a dependency's name has the form `-lname', make
handles it specially by searching for the file `libname.a' in
the current directory, in directories specified by matching vpath
search paths and the VPATH
search path, and then in the
directories `/lib', `/usr/lib', and `prefix/lib'
(normally `/usr/local/lib', but MS-DOS/MS-Windows versions of
make
behave as if prefix is defined to be the root of the
DJGPP installation tree).
For example,
foo : foo.c -lcurses cc $^ -o $@
would cause the command `cc foo.c /usr/lib/libcurses.a -o foo' to be executed when `foo' is older than `foo.c' or than `/usr/lib/libcurses.a'.
Go to the first, previous, next, last section, table of contents.