automake: Include
1
1 19 Include
1 **********
1
1 Automake supports an ‘include’ directive that can be used to include
1 other ‘Makefile’ fragments when ‘automake’ is run. Note that these
1 fragments are read and interpreted by ‘automake’, not by ‘make’. As
1 with conditionals, ‘make’ has no idea that ‘include’ is in use.
1
1 There are two forms of ‘include’:
1
1 ‘include $(srcdir)/file’
1 Include a fragment that is found relative to the current source
1 directory.
1
1 ‘include $(top_srcdir)/file’
1 Include a fragment that is found relative to the top source
1 directory.
1
1 Note that if a fragment is included inside a conditional, then the
1 condition applies to the entire contents of that fragment.
1
1 Makefile fragments included this way are always distributed because
1 they are needed to rebuild ‘Makefile.in’.
1
1 Inside a fragment, the construct ‘%reldir%’ is replaced with the
1 directory of the fragment relative to the base ‘Makefile.am’.
11 Similarly, ‘%canon_reldir%’ is replaced with the canonicalized (⇒
Canonicalization) form of ‘%reldir%’. As a convenience, ‘%D%’ is a
1 synonym for ‘%reldir%’, and ‘%C%’ is a synonym for ‘%canon_reldir%’.
1
1 A special feature is that if the fragment is in the same directory as
1 the base ‘Makefile.am’ (i.e., ‘%reldir%’ is ‘.’), then ‘%reldir%’ and
1 ‘%canon_reldir%’ will expand to the empty string as well as eat, if
1 present, a following slash or underscore respectively.
1
1 Thus, a makefile fragment might look like this:
1
1 bin_PROGRAMS += %reldir%/mumble
1 %canon_reldir%_mumble_SOURCES = %reldir%/one.c
1