Next: , Previous: , Up: Input files for projects with subdirectories   [Contents][Index]

5.3.2 Conditional Subdirectories

It is possible to define the SUBDIRS variable conditionally if, as in the case of GNU Inetutils, you want to only build a subset of the entire package.

To illustrate how this works, let’s assume we have two directories src/ and opt/. src/ should always be built, but we want to decide in configure whether opt/ will be built or not. (For this example we will assume that opt/ should be built when the variable ‘$want_opt’ was set to ‘yes’.)

Running make should thus always recurse into src/, and only conditionally into opt/. However ‘make dist’ should always recurse into both src/ and opt/ unconditionally, because opt/ should be distributed even if it is not needed in the current configuration, so opt/Makefile needs to be created.

The main way to manage conditionally built subdirectories is to always configure in all subdirectories. This is achieved with the DIST_SUBDIRS variable. Alternatively, it may be possible not to configure a subdirectory you need to distribute: see Unconfigured Subdirectories, below.