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

5.3.3 An Alternative Approach to Subdirectories

Recursive make invocations can be both slow and error-prone. (For more information, see Peter Miller’s paper, Recursive Make Considered Harmful.) Automake provides sufficient cross-directory support to write a single Makefile.am for a complex multi-directory package. 4

By default an installable file specified in a subdirectory will have its directory name stripped before installation. For instance, in this example, the header file will be installed as $(includedir)/stdio.h:

include_HEADERS = inc/stdio.h

However, the ‘nobase_’ prefix can be used to circumvent this path stripping. In this example, the header file will be installed as $(includedir)/sys/types.h:

nobase_include_HEADERS = sys/types.h

nobase_’ should be specified first when used in conjunction with either ‘dist_’ or ‘nodist_’ (see Fine-grained Distribution Control). For instance:

nobase_dist_pkgdata_DATA = images/vortex.pgm sounds/whirl.ogg

Finally, note that a variable using the ‘nobase_’ prefix can often be replaced by several variables, one for each destination directory (see Variables based on primaries). For instance, the last example could be rewritten as follows:

imagesdir = $(pkgdatadir)/images
soundsdir = $(pkgdatadir)/sounds
dist_images_DATA = images/vortex.pgm
dist_sounds_DATA = sounds/whirl.ogg

This latter syntax makes it possible to change one destination directory without changing the layout of the source tree.

Currently, ‘nobase_*_LTLIBRARIES’ are the only exception to this rule, in that there is no particular installation order guarantee for an otherwise equivalent set of variables without ‘nobase_’ prefix.

Footnotes

(4)

We believe. This work is new and there are probably warts. See Automake resources for information on reporting bugs.

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