5.3.2.2 Subdirectories with AM_CONDITIONAL

One method of conditional subdirectories is for
configure to output the Makefile for all directories
unconditionally, using AC_CONFIG_FILES.
configure will also define an Automake conditional under which
opt/ should be built.
(See Conditionals.)

In this case Automake will define ‘DIST_SUBDIRS = src opt’
automatically, because it knows that MAYBE_OPT can contain
‘opt’.

Running make will recurse into
src/, and possibly opt/ as well, depending on the value of the
conditional.
Running ‘make dist’ will recurse into both
src/ and opt/ directories because ‘make dist’, unlike
‘make all’,
uses the DIST_SUBDIRS variable instead of the SUBDIRS variable.
In all cases, the make recursion works because the subdirectories
have been configured.