automake: Conditional Subdirectories

1 
1 7.2 Conditional Subdirectories
1 ==============================
1 
1 It is possible to define the ‘SUBDIRS’ variable conditionally if, like
1 in the case of GNU Inetutils, you want to only build a subset of the
1 entire package.
1 
1    To illustrate how this works, let’s assume we have two directories
1 ‘src/’ and ‘opt/’.  ‘src/’ should always be built, but we want to decide
1 in ‘configure’ whether ‘opt/’ will be built or not.  (For this example
1 we will assume that ‘opt/’ should be built when the variable ‘$want_opt’
1 was set to ‘yes’.)
1 
1    Running ‘make’ should thus recurse into ‘src/’ always, and then maybe
1 in ‘opt/’.
1 
1    However ‘make dist’ should always recurse into both ‘src/’ and
1 ‘opt/’.  Because ‘opt/’ should be distributed even if it is not needed
1 in the current configuration.  This means ‘opt/Makefile’ should be
1 created _unconditionally_.
1 
1    There are two ways to setup a project like this.  You can use
1 Automake conditionals (⇒Conditionals) or use Autoconf ‘AC_SUBST’
11 variables (⇒Setting Output Variables (autoconf)Setting Output
 Variables.).  Using Automake conditionals is the preferred solution.
1 Before we illustrate these two possibilities, let’s introduce
1 ‘DIST_SUBDIRS’.
1 

Menu