Install a library

This assumes you are using Make.gfxtools.rules in your Makefile as described in the Build a library with Make.gfxtools.rules tutorial. In this example, we'll add the necessary lines to the Makefile to install the library and header files from that tutorial.

As with programs, there are several pre-defined rules in Make.gfxtools.rules for installing libraries. To install the library archive file, we just need to make an install target that calls those. We also need to install the header files for the library in $G/include/projectname. There is also a predefined target for this, called inst-h, which will install any header files listed as a space separated list in the "H" Makefile variable. Here is an updated Makefile with the additional install target.




# by default, build all versions of the library
all:   libg libo libp

# rule to compile the debug version
debug: libg

# rule to compile the optimized version
opt:   libo

# rule to compile the profiling version
prof:  libp

# installs all versions of the library and the headers
install:  inst-libg inst-libo inst-libp inst-h

include $(G)/lib/Make.gfxtools.rules