1.4 Build Avoidance

The build tool attempts to avoid rebuilding derived objects. If an appropriate derived object exists in the view, clearmake or omake reuses that DO. If there is no appropriate DO in the view, clearmake or omake looks for an existing DO built in another view that can be winked in to the current view. The search process is called shopping.

The process of qualifying a candidate DO is called configuration lookup. It involves matching information in the VOB from the candidate DO's config record against the user's current build configuration. This process guarantees correct results in a parallel development environment, which the standard time-stamp-based algorithm used by make cannot do. Even if an object module is newer than a particular version of its source file, the module may have been built using a different version. In fact, reusing object modules and executables built recently is likely to be incorrect when rebuilding a previous release of an application from old sources. The configuration lookup algorithm that ClearCase uses guarantees that your builds will be both correct (inappropriate objects are not reused) and optimal (appropriate objects are always reused).

For a DO to be reused or winked in, the build configuration documented in its configuration record must match the current view's build configuration. The build configuration consists of two items:

Files

The versions of elements listed in the CR must match the versions selected by the view in which the build is performed. Any view-private files or non-MVFS files listed in the CR must also match.

Build procedure

The build options in the CR must match the build options specified on the command line, in the environment, in makefiles, or in build options specification files.

The build script listed in the CR must match the script that will be executed if the target is rebuilt. The scripts are compared with all make macros expanded; thus, a match occurs only if the same build options apply (for example, "compile for debugging").

The search ends when clearmake or omake finds a DO whose configuration matches the view's current build configuration exactly. In general, a configuration lookup can have three outcomes:

Reuse and winkin take place only if clearmake or omake determines that a newly built derived object would be identical to the existing one. Winkin takes place when two or more views select the same versions of source elements used in a build. For example, you can create another view that has the same configuration as an existing view. Initially, the new view sees all the sources but contains no derived objects. Running clearmake or omake winks in many derived objects from the existing view.

Hierarchical Builds

In a hierarchical build, some objects are built and then used to build others. The build tool performs configuration lookup separately for each target. To ensure a consistent result, the build tool also applies this principle: when a new object is created, all targets that depend on it are rebuilt. Note that winkin does not cause rebuilds of dependencies.

Automatic Dependency Detection

Configuration records enable automatic checking of source dependencies as part of build avoidance. All such dependencies (for example, on C-language header files) are logged in a build's configuration record, whether or not they are explicitly declared in a makefile.