Next: Subdirectories with AC_SUBST, Previous: SUBDIRS vs DIST_SUBDIRS, Up: Conditional Subdirectories
configure should output the Makefile for each directory and define a condition into which opt/ should be built.
... AM_CONDITIONAL([COND_OPT], [test "$want_opt" = yes]) AC_CONFIG_FILES([Makefile src/Makefile opt/Makefile]) ...
SUBDIRS can be defined in the top-level Makefile.am
if COND_OPT MAYBE_OPT = opt endif SUBDIRS = src $(MAYBE_OPT)
As you can see, running make will rightly recurse into src/ and maybe opt/.
As you can't see, running ‘make dist’ will recurse into both
src/ and opt/ directories because ‘make dist’, unlike
‘make all’, doesn't use the
SUBDIRS variable. It uses the
In this case Automake will define ‘DIST_SUBDIRS = src opt’
automatically because it knows that
MAYBE_OPT can contain
‘opt’ in some condition.