Make Q's

Joshua Judson Rosen rozzin at geekspace.com
Fri Sep 18 13:43:32 EDT 2009


Derek Atkins <warlord at MIT.EDU> writes:
>
> Joshua Judson Rosen <rozzin at geekspace.com> writes:
> 
> > project_SOURCES = file1.c file2.c \
> > 		file3.cpp file4.cpp file5.cpp file6.cpp file7.cpp
> > # (NOTE: project_SOURCES should also include
> > #  any corresponding header-files)
> 
> Actually, no, you should use:
> 
> project_HEADERS = file1.h file2.h ...

Actually, while there *is* a `_HEADERS' primary in Automake,
that's not what it means--listing things in "project_HEADERS"
means `these are headers that will be installed into ${projectdir}
by "make install"', while "project_SOURCES" establishes the headers
as source-files that contribute to building the `project' binary
(and they explicitly become part of its list of dependencies).

Any `public' headers that are part of a library's public interface
should be listed in ${include_HEADERS} (or ${pkginclude_HEADERS}, or
something in the same vein); any *private* headers should usually go
into ${project_SOURCES}, though you might want to put them into
${noinst_HEADERS} if the they aren't directly associated with
(`owned by') any particular built object. The Automake manual says:

       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 actually belongs
    to one convenient library or program, we recommend listing it in
    the program's or library's `_SOURCES' variable (*note 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.

There's /is/ also the matter of ensuring that everything necessary
gets into the tarballs genertated by `make dist', and including files
in *any* of these lists will accomplish that.

-- 
Don't be afraid to ask (Lf.((Lx.xx) (Lr.f(rr)))).


More information about the gnhlug-discuss mailing list