9.3. Using build-also for Top-level Builds

Starting with abuild version 1.0.3, it is possible to list other build items in the build-also key of any named build item's Abuild.conf file. Starting with abuild version 1.1.4, build-also keys can list entire trees and also add options to include tree dependencies or other items at or below the item's directory. When abuild adds any build item to the build set, if that build item has a build-also key, then any build items listed there are also added to the build set. The operation of expanding initial build set membership using the build-also key is applied iteratively until no more build items are added. The principal intended use of this feature is to aid with setting up virtual “top-level” build items. For example, if your system consisted of multiple, independent subsystems and you wanted to build all of them, you could create a build item that lists the main items for each subsystem in a build-also key.

Arguments to build-also may be as follows:

[item:]item-name [-desc]

Add item-name to the build set. The literal item: prefix may be omitted for backward compatibility.

If the -desc option is given, all items at or below the directory containing item-name are also added to the build set. This is equivalent to running abuild --build=desc from item-name's directory.

tree:tree-name [-desc] [-with-tree-deps]

If tree:tree-name is specified by itself, all items in the build tree named tree-name are added to the build set. This is equivalent to running abuild --build=local somewhere in that tree.

If -desc appears as an option by itself, all items at or below the directory containing the root of tree-name are added to the build set. This is equivalent to running abuild --build=desc from the directory containing the root of the tree.

If -with-tree-deps appears as an option by itself, all items in all trees that tree-name specifies as tree dependencies are added to the build set in addition to all items in tree-name itself. This is equivalent to running abuild --build=deptrees somewhere in that tree.

If -with-tree-deps and -desc are both specified, the result is to add the items that are in the intersection of the two options specified individually. In other words, all items that are in any dependent tree and are at or below the directory containing the root of the tree are added to the build set. This is equivalent to running abuild --build=descdeptrees at the root of the build tree. Note that if you want the union of -desc and -with-tree-deps instead of the intersection, you simply have to specify both tree:tree-name -desc and tree:tree-name -with-tree-deps in the build-also key.

In older versions of abuild, the only way to force building of one build item to build another item was to declare dependencies or tree dependencies. This had several disadvantages, including the following:

Whenever you want building of one build item to result in building of another build item and the first item doesn't need to use anything from the items it causes to be built, it is appropriate to use build-also instead of a dependency.