ClearCase build utility; maintains, updates, and regenerates groups of programs
clearmake is ClearCase's variant of the UNIX make utility. It features a Gnu make compatibility mode, which enables you to use clearmake with makefiles that were constructed for use with Gnu make.
clearmake features a number of ClearCase extensions:
NOTE: clearmake is intended for use in dynamic views. You can use clearmake in a snapshot view, but most of the features that distinguish it from ordinary make programs-build avoidance, build auditing, derived object sharing, and so on-are not enabled in snapshot views. (Parallel builds are enabled.) The rest of the information in this reference page assumes you are using clearmake in a dynamic view.
The following reference pages include information related to clearmake operations and results:
Builds software on Windows NT and provides compatibility with PC-based make products. | |
Runs audited builds. | |
(cleartool subcommand) Lists derived objects created by clearmake, omake, or clearaudit. | |
(cleartool subcommand) Displays configuration records created by clearmake, omake, or clearaudit. | |
(cleartool subcommand) Compares configuration records created by clearmake, omake, or clearaudit. | |
(cleartool subcommand) Removes a derived object from a VOB. | |
(cleartool subcommand) Winks in a derived object to a view or to the VOB. |
See also Building Software with ClearCase.
For a build that uses the data in one or more VOBs, the command interpreter from which you invoke clearmake must have a view context; you must be on the dynamic-views drive (default: M:\) or a drive assigned to a view. If you want derived objects to be shared among views, you must be on a drive assigned to a view.
You can build objects in a standard directory, without a view context, but this disables many of clearmake's special features.
clearmake is designed to read makefiles in a way that is compatible with other make variants. For details, including discussions of areas in which the compatibility is not absolute, see Using clearmake Compatibility Modes in Building Software with ClearCase.
For more information about makefiles and clearmake, see clearmake Makefiles and BOS Files in Building Software with ClearCase.
In many ways, ClearCase builds adhere closely to the standard make paradigm:
The following sections describe special clearmake build features in more detail. Figure 8 illustrates the associated data flow.
Figure 8 Data Flow in a clearmake Build
In conjunction with the MVFS file system, clearmake audits the execution of all build scripts, keeping track of file use at the system-call level. For each execution of a build script, it creates a configuration record (CR), which includes the versions of files and directories used in the build, the build script, build options, (for example, macro assignments) and other related information. A copy of the CR is stored in the VOB database of each VOB in which the build script has built new objects.
A file created within a VOB by a build script is called a derived object (DO), and it can be shareable or nonshareable. When a shareable derived object is built in a view, a corresponding VOB database object is also created. This enables any view to access and possibly share (subject to access permissions) any derived object, no matter what view it was originally created in.
When a build tool creates a nonshareable derived object, the tool does not write any information about the DO to the VOB. Therefore, the DO is invisible to other views and cannot be winked in by them. Builds that create nonshareable DOs are called express builds. For more information about using express builds, see Preventing Winkin to Other Views.
NOTE: Symbolic links created by a build script and files created in non-VOB directories are not DOs. See MVFS FILES AND NON-MVFS OBJECTS.
For each build script execution, ClearCase logically associates each DO created with the build script's CR.
You can suppress the creation of CRs and derived objects with the -F option. For details on CRs, derived objects, see Derived Objects and Configuration Records in Building Software with ClearCase. For information on ClearCase-specific special targets, see clearmake Makefiles and BOS Files in Building Software with ClearCase.
A typical makefile has a hierarchical structure. Thus, a single invocation of clearmake to build a high-level target can cause multiple build scripts to be executed and, accordingly, multiple CRs to be created.
For directory targets, clearmake uses standard make logic.
When a target names a nondirectory file in a VOB, clearmake (by default) uses configuration lookup to determine whether a build is required. This involves comparing the CRs of existing DOs with the current build configuration:
In performing configuration lookup, clearmake considers a DO version (a derived object that has been checked in as a version of an element) only if the version's element has the same pathname as the original derived object. That is, if you copy a DO to a different location from where it was created and check it in there, clearmake does not consider the DO version.
clearmake first tries to avoid rebuilding by reusing a DO in the current view; this succeeds only if the CR of the candidate DO matches the current build configuration. For the purpose of rebuilding, a branch/0 version of a file selected by a view is considered to match its non-zero predecessor version in a CR.
clearmake can also avoid rebuilding by finding a shareable DO, built in another view, whose CR matches the current build configuration. In this case, it winks in (winkin) that derived object, causing it to be shared among views. Other derived objects created by the same build script (siblings) are winked in at the same time. clearmake rebuilds a target only if it cannot locate any existing derived object that matches the current build configuration.
The .cmake.state file is a view-private cache of config records for derived objects built in the view. clearmake creates this file in the directory that was current when the build started. During subsequent builds in that directory in the view, clearmake references the file instead of communicating with the VOB. This makes configuration lookup faster, improving clearmake performance.
You can delete .cmake.state files if they get too large. When clearmake looks for a .cmake.state file and it doesn't exist, no errors occur and clearmake creates a new file.
You can override the default configuration lookup behavior with command options and ClearCase special targets. (For information on ClearCase special targets, see clearmake Makefiles and BOS Files in Building Software with ClearCase). For example, -T turns off configuration lookup, basing rebuild decisions on time stamps, and -V disables winkin of DOs from other views.
You can prevent derived objects that you create from being winked in to other views by using express builds. During an express build, clearmake creates nonshareable DOs. These DOs have config records, but clearmake does not write information about the DOs into the VOB. DOs created during an express build are invisible to other views. To use express builds, invoke clearmake in a view configured with the nonshareable DOs property:
All files with pathnames below a VOB-tag (VOB mount point) are termed MVFS files:
Conversely, a non-MVFS object is any file or directory whose pathname is not under a VOB-tag; such objects are not version controlled. By default, non-MVFS objects are not audited during clearmake builds. Non-MVFS files that are read during a build are not included in the detected dependency list of the CR, and non-MVFS files that are created are not ClearCase derived objects. A CR includes information on a non-MVFS object used by a build script only if either of these conditions are true:
The explicit dependency is referred to as a makefile dependency. For example:
src.o : c:\msvc20\include\stdio.h
A build options specification (BOS) file is a text file containing macro definitions and/or ClearCase special targets. We recommend that you place nonpermanent option specifications (for example, a macro that specifies "compile for debugging") in a BOS file, instead of on the clearmake command line. This minimizes the likelihood of having clearmake perform a rebuild unexpectedly (for example, because you specified /Zi on a compiler command line last time, but forgot to specify it this time).
See clearmake Makefiles and BOS Files in Building Software with ClearCase for details.
clearmake can monitor the current VOB's lock status during a build, so that if an administrator locks the VOB while clearmake is running, the build does not terminate abnormally. Before executing the build script and before creating a derived object and configuration record, clearmake checks the lock status of the current VOB. If the VOB is locked, clearmake starts a sleep-check cycle. When it finds the VOB unlocked, the build proceeds.
NOTE: clearmake starts the sleep-check cycle even if the user who invokes the build is on the exception list for the lock.
When a sleep-check cycle begins, clearmake prints a message announcing the sleep, its duration, and the reason for it. Initially, clearmake checks the lock status 10 times, waiting 60 seconds between attempts. clearmake then increments the sleep time by 5 seconds and again tries 10 times, and so on. clearmake prints a sleep message at the start of each group of 10 retries.
This implementation does not guarantee that the build will not terminate abnormally. There are still a few "windows of failure." The build script will fail and terminate abnormally, and the build will terminate if any of these conditions is true:
By default, clearmake checks the VOB containing the working directory that was current at the start of the build. To check a set of VOBs, set the environment variable CCASE_BLD_VOBS to the list of VOB-tags to check. Separate the VOB-tags in the list with a space, tab (\t), semicolon (;), or comma (,).
To disable the checks, set the environment variable CCASE_BLD_NOWAIT. When this environment variable is set, clearmake does not check for a VOB-lock (or wait for the VOB to be unlocked).
When clearmake shops for a derived object to wink in to a build, it may find DOs from a view that is unavailable (because the view server host is down, the albd_server is not running on the server host, and so on). Attempting to fetch the DO's configuration record from an unavailable view causes a long time-out, and the build may reference multiple DOs from the same view.
clearmake and other cleartool commands that access configuration records and DOs (lsdo, describe, catcr, diffcr) maintain a cache of tags of inaccessible views. For each view-tag, the command records the time of the first unsuccessful contact. Before trying to access a view, the command checks the cache. If the view's tag is not listed in the cache, the command tries to contact the view. If the view's tag is listed in the cache, the command compares the time elapsed since the last attempt with the time-out period specified by the CCASE_DNVW_RETRY environment variable. If the elapsed time is greater than the time-out period, the command removes the view-tag from the cache and tries to contact the view again.
NOTE: The cache is not persistent across clearmake sessions. Each recursive or individual invocation of clearmake attempts to contact a view whose tag may have been cached in a previous invocation.
The default time-out period is 60 minutes. To specify a different time-out period, set CCASE_DNVW_RETRY to another integer value (representing minutes). To disable the cache, set CCASE_DNVW_RETRY to 0.
clearmake takes into account the fact that as your build progresses, other developers can continue to work on their files, and may check in new versions of elements that your build uses. If your build takes an hour to complete, you do not want build scripts executed early in the build to use version 6 of a header file, and scripts executed later to use version 7 or 8. To prevent such inconsistencies, clearmake locks out any version that meets both of these conditions:
This reference-time facility applies to checked-in versions of elements only; it does not lock out changes to checked-out versions, other view-private files, and non-MVFS objects. clearmake adjusts for the fact that the system clocks on different hosts in a network may be somewhat out of sync (clock skew).
For more information, see Pointers on Using ClearCase Build Tools in Building Software with ClearCase.
clearmake returns a zero exit status if all goal targets are successfully processed. It returns a nonzero exit status in two cases:
See also the description of the -q option.
clearmake supports the options below. In general, standard make options are lowercase characters and clearmake extensions are uppercase. Options that do not take arguments can be combined on the command line (for example, -rOi).
@) are listed. See clearmake Makefiles and BOS Files in Building Software with ClearCase.
|
|
gnu | Emulates the Free Software Foundation's Gnu make program. To define built-in make rules, clearmake reads file ccase-home-dir\etc\gnubuiltin.mk instead of ccase-home-dir\etc\builtin.mk. |
std | Invokes the standard clearmake with no compatibility mode enabled. Use this option to nullify a setting of the environment variable CCASE_MAKE_COMPAT. |
|
|
String-valued variables called make macros can be used anywhere in a makefile: in target lists, in dependency lists, and/or in build scripts. For example, the value of make macro CFLAGS can be incorporated into a build script as follows:
cl $(CFLAGS) msg.c
Environment variables (EVs) can also be used in a makefile, but only in a build script. For example:
print:
print_report -style $$PRT_STYLE -dest $${PRT_DEST}.rpt
clearmake converts the double-dollar-sign ($$) to a single dollar sign; the EV is expanded in the shell in which the build script executes only if the shell recognizes the dollar sign ($) (cmd.exe does not).
Conflicts can occur in specifications of make macros and environment variables. For example, the same make macro might be specified both in a makefile and on the command line; or the same name may be specified both as a make macro and as an environment variable.
clearmake resolves such conflicts similarly to other make variants; it uses the following priority order, from highest to lowest:
Using the -e option gives environment variables higher priority than make macros specified in a makefile.
Conflict Resolution Details. The following discussion treats this topic more precisely but less concisely.
clearmake starts by converting all EVs in its environment to make macros. (SHELL is an exception-see SHELL Environment Variable.) These EVs are also placed in the environment of the shell process in which a build script executes. Then, it adds in the make macros declared in the makefile. If this produces name conflicts, they are resolved as follows:
Finally, clearmake adds make macros specified on the command line or in a BOS file; these settings are also added to the environment. These assignments always override any others that conflict. (A command-line assignment overrides a BOS setting of the same macro.)
clearmake does not use the SHELL environment variable to select the shell program in which to execute build scripts. It uses cmd.exe, unless you specify another program with a SHELL macro. You can specify SHELL on the command line, in the makefile, or in a build options spec; the value of SHELL must be a full pathname, including the file extension.
NOTE: If clearmake determines that it can execute the build script directly, it does not use the shell program even if you specify one explicitly. If you use .bat files in build scripts, you must make them executable (use the cleartool protect command). To force clearmake to always use the shell program, set the environment variable CCASE_SHELL_REQUIRED.
The CCASE_MAKEFLAGS and MAKEFLAGS environment variables provide an alternative (or supplementary) mechanism for specifying clearmake command options. These environment variables can contain a string of keyletters, the same letters used for clearmake command-line options. (However, clearmake does not allow options that take arguments in a CCASE_MAKEFLAGS or MAKEFLAGS string. See Special Environment Variables for information about specifying options that are not supported through CCASE_MAKEFLAGS or MAKEFLAGS.)
setenv CCASE_MAKEFLAGS ei | (options set in environment) |
clearmake foo |
|
clearmake -ei foo | (options set on command line) |
clearmake combines the value of CCASE_MAKEFLAGS or MAKEFLAGS with the options specified on the command line (if any). The combined string of keyletters becomes the value of the macro MAKEFLAGS, available to build scripts.
This is very useful for build scripts that involve recursive invocations of clearmake. When clearmake -n is applied to such a build script, all the nested invocations of clearmake pick up the "no-execute" option from the value of CCASE_MAKEFLAGS or MAKEFLAGS. Thus, no targets are actually rebuilt, even though many levels of clearmake command may be executed. This is one way to debug all of the makefiles for a software project without building anything.
clearmake uses one of CCASE_MAKEFLAGS or MAKEFLAGS, but not both. If CCASE_MAKEFLAGS is set, clearmake uses it. If CCASE_MAKEFLAGS is not set, clearmake looks for MAKEFLAGS.
If you use other make programs in addition to clearmake, putting clearmake-specific options in the MAKEFLAGS environment variable may cause the make programs to generate errors. Therefore, we suggest you use the CCASE_MAKEFLAGS and MAKEFLAGS environment variables in the following ways:
| If you use... | Use... |
|---|---|
clearmake only | CCASE_MAKEFLAGS |
clearmake and other make programs, but do not use clearmake-specific options | MAKEFLAGS |
clearmake and other make programs, and do use clearmake-specific options | CCASE_MAKEFLAGS (all options) for clearmake builds MAKEFLAGS (all options except clearmake-specific options) for other make builds |
The environment variables described below are also read by clearmake at startup. In some cases, as noted, you can also specify the information as a make macro on the command line, in a makefile, or in a BOS file.
1 | Equivalent to -v on the command line |
2 | Equivalent to -d on the command line |
0 or undefined | Equivalent to standard message logging level |
z:\src> clearmake -u -f project.mk
z:\src> clearmake -v -O hello
y:\> clearmake -T INCL_DIR=\src\include_test
z:\src> clearmake -e -V bgrs.exe
clearaudit, omake, promote_server, scrubber
Building Software with ClearCase
|
Feedback on the documentation in this site? We welcome any comments!
Copyright © 1999 by Rational Software Corporation. All rights reserved. |