This is normally done by telling the compiler where to find header files and by telling the linker where to find libraries. The
gcc and most/many/some other C compilers use the '-I' (uppercase 'eye') switch to add a specified directory to the "list of places to find include files". Similarly, the linker obeys the '-L' switch to find libraries.
By convention, makefiles use a couple of macros, CFLAGS & LDFLAGS, to specify these commandline switches. The CFLAGS and LDFLAGS macros are expanded on the compiler/linker commandlines, and cause these tools to look in the right places. Also by convnention, CFLAGS & LDFLAGS are defined somewhere near the top of the Makefile, often in a manner similar to this (assuming GNU make):
Code:
CFLAGS += -I /some/directory -I /someother/directory
LDFLAGS += -L /some/private/libdir
You will probably also have to add to the list of libraries to link, which is done in a slightly unintuitive way. If the name of your library is
libMyStuff.so, then you would do something like:
Code:
LDFLAGS += -lMyStuff
The linker will understand that it should look for
libMyStuff.so
--- rod.