automake: SUBDIRS vs DIST_SUBDIRS

1 
1 7.2.1 ‘SUBDIRS’ vs. ‘DIST_SUBDIRS’
1 ----------------------------------
1 
1 Automake considers two sets of directories, defined by the variables
1 ‘SUBDIRS’ and ‘DIST_SUBDIRS’.
1 
1    ‘SUBDIRS’ contains the subdirectories of the current directory that
1 must be built (⇒Subdirectories).  It must be defined manually;
1 Automake will never guess a directory is to be built.  As we will see in
1 the next two sections, it is possible to define it conditionally so that
1 some directory will be omitted from the build.
1 
1    ‘DIST_SUBDIRS’ is used in rules that need to recurse in all
1 directories, even those that have been conditionally left out of the
1 build.  Recall our example where we may not want to build subdirectory
1 ‘opt/’, but yet we want to distribute it?  This is where ‘DIST_SUBDIRS’
1 comes into play: ‘opt’ may not appear in ‘SUBDIRS’, but it must appear
1 in ‘DIST_SUBDIRS’.
1 
1    Precisely, ‘DIST_SUBDIRS’ is used by ‘make maintainer-clean’, ‘make
1 distclean’ and ‘make dist’.  All other recursive rules use ‘SUBDIRS’.
1 
1    If ‘SUBDIRS’ is defined conditionally using Automake conditionals,
1 Automake will define ‘DIST_SUBDIRS’ automatically from the possible
1 values of ‘SUBDIRS’ in all conditions.
1 
1    If ‘SUBDIRS’ contains ‘AC_SUBST’ variables, ‘DIST_SUBDIRS’ will not
1 be defined correctly because Automake does not know the possible values
1 of these variables.  In this case ‘DIST_SUBDIRS’ needs to be defined
1 manually.
1