CTBUILD is itself a package meeting the CTEST interface. In the following, the directory for this package is denoted $CTBUILD and the directory for the installation is $CTINSTALL. The location of the CTBUILD package is taken from the environmental variable CTBUILD_DIR.
The command creates the installation makefile $CTINSTALL/ctinfo/installation.mk. This make fragment holds the definitions of the installation directories and search paths. It includes $CTINSTALL/ctinfo/arch.mk. This file defines the architecture-dependent variables (compilers, linkers, etc.). This file is copied from $CTBUILD/arch/$CTOPSYS-$CTCXX-$CTCXXOPT.mk where the three symbols making up the filename specify the operating system, the compiler and the compiler optimization.
ctbuild pkg tgt1 [tgt2...] ctbuild -a trg1 [tgt2...]In the former, the targets tgt1, tgt2,... are invoked on the package. In the latter case, the targets are invoked on the installation.
This script makes use of two environmental variables: CTBUILD_DIR as defined above CTINSTALL which gives the location of the installation. The command calls gmake with the makefile $CTBUILD/make/package.mk. This makefile may also be invoked directly.
This makefile includes $CTINSTALL/ctinfo/installation.mk and $CTBUILD/make/install_rules.mk. The latter defines targets for creating installation directories. It also defines clear targets which do not depend on individual packages.
The makefile then includes the target makefiles include.mk, script.mk, lib.mk, obj.mk, bin.mk, ctest.mk and itest.mk. All are found in $CTINSTALL/ctinfo/$CTPKG where $CTPKG is the package name. The top-level makefile defines rules to create each fragment xxx.mk using the script $CTBUILD/make/build_xxx.mk.
These target fragments are the heart of CTBUILD. They define the rules for building and clearing targets. The scripts read and interpret the CTEST instruction files and write a separate rule for each product associated with that target and package. Thus CTBUILD runs very quickly after the first pass which builds these fragments.
The target fragments depend on the the instruction files and are rebuilt if the instructions change. They include the usual dependency files which specify the dependency of products on source code. The target fragments also define the dependency of products on the "index files". These specify the location of the source products (i.e. products from which the current product is built).
Each target fragment defines a rule to build the index files corresponding to its installed products and updates the index when the product is built. The global make fragment install_rules.mk defines default rules to build the index files. These search the path associated with the target type.
The relationships between the various make fragments and the products are shown in the figure.
There are some test packages in $CTBUILD/testpkg.