automake: Program Sources

1 
1 8.1.1 Defining program sources
1 ------------------------------
1 
1 In a directory containing source that gets built into a program (as
1 opposed to a library or a script), the ‘PROGRAMS’ primary is used.
1 Programs can be installed in ‘bindir’, ‘sbindir’, ‘libexecdir’,
1 ‘pkglibexecdir’, or not at all (‘noinst_’).  They can also be built only
1 for ‘make check’, in which case the prefix is ‘check_’.
1 
1    For instance:
1 
1      bin_PROGRAMS = hello
1 
1    In this simple case, the resulting ‘Makefile.in’ will contain code to
1 generate a program named ‘hello’.
1 
1    Associated with each program are several assisting variables that are
1 named after the program.  These variables are all optional, and have
1 reasonable defaults.  Each variable, its use, and default is spelled out
1 below; we use the “hello” example throughout.
1 
1    The variable ‘hello_SOURCES’ is used to specify which source files
1 get built into an executable:
1 
1      hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h system.h
1 
1    This causes each mentioned ‘.c’ file to be compiled into the
1 corresponding ‘.o’.  Then all are linked to produce ‘hello’.
1 
1    If ‘hello_SOURCES’ is not specified, then it defaults to the single
1 file ‘hello.c’ (⇒Default _SOURCES).
1 
1    Multiple programs can be built in a single directory.  Multiple
1 programs can share a single source file, which must be listed in each
1 ‘_SOURCES’ definition.
1 
1    Header files listed in a ‘_SOURCES’ definition will be included in
1 the distribution but otherwise ignored.  In case it isn’t obvious, you
1 should not include the header file generated by ‘configure’ in a
1 ‘_SOURCES’ variable; this file should not be distributed.  Lex (‘.l’)
1 and Yacc (‘.y’) files can also be listed; see ⇒Yacc and Lex.
1