Header files that must be installed are specified by the
HEADERS
family of variables. Headers can be installed in
includedir
, oldincludedir
, pkgincludedir
or any
other directory you may have defined (see The Uniform Naming Scheme). For instance,
include_HEADERS = foo.h bar/bar.h
will install the two files as $(includedir)/foo.h and $(includedir)/bar.h.
The nobase_
prefix is also supported:
nobase_include_HEADERS = foo.h bar/bar.h
will install the two files as $(includedir)/foo.h and $(includedir)/bar/bar.h (see An Alternative Approach to Subdirectories).
Usually, only header files that accompany installed libraries need to
be installed. Headers used by programs or convenience libraries are
not installed. The noinst_HEADERS
variable can be used for
such headers. However, when the header belongs to a single
convenience library or program, we recommend listing it in the
program’s or library’s _SOURCES
variable (see Defining program sources) instead of in noinst_HEADERS
. This is clearer for
the Makefile.am reader. noinst_HEADERS
would be the
right variable to use in a directory containing only headers and no
associated library or program.
All header files must be listed somewhere; in a _SOURCES
variable or in a _HEADERS
variable. Missing ones will not
appear in the distribution.
For header files that are built and must not be distributed, use the
nodist_
prefix as in nodist_include_HEADERS
or
nodist_prog_SOURCES
. If these generated headers are needed
during the build, you must also ensure they exist before they are
used (see Built Sources).