Handling temporary changes in the build procedure

Typically, you do not edit the build script of a target in the makefile very often.

But you might often change the build script by specifying overrides for make macros, either on the command line or in the Windows environment. For example, target hello.obj is specified as follows in the makefile:

hello.obj: hello.c hello.h
   del hello.obj
   cl /c $(CFLAGS) hello.c

When it executes this build script, omake (or clearmake) enters the build script, after macro substitution, into the config record. The command

Z:\myvob> omake hello.obj CFLAGS="/02 /G5"

produces this configuration record entry:

--------------------------------
Build script:
--------------------------------        cl /c /02 /G5 hello.c

The omake (or clearmake) build-avoidance algorithm compares effective build scripts. If you then use the command omake hello.obj without specifying CFLAGS="/02 /G5", omake (or clearmake) rejects the existing derived object, which was built with those flags. The same mismatch occurs if you create a CFLAGS environment variable with a different value, and then invoke omake (or clearmake) with the -e option.

Specifying build options

To manage temporary overrides for make macros and environment variables, place macro definitions in build options specification (BOS) files. clearmake provides several ways for using a BOS file. For example, if your makefile is named project.mk, macro definitions are read from project.mk.options. You can also keep a BOS file in your home directory or specify one or more BOS files with clearmake -A. For more information, see Build options specification files.

To manage these temporary overrides with omake, you can place macro definitions in a separate makefile. To include this makefile, specify the -f makefile option.

Using a BOS file or separate makefile to specify make macro overrides preserves these options, which makes it easier to reuse them. If you do not modify the BOS or separate makefile frequently, derived objects in your view are not disqualified for reuse on the basis of build script discrepancies. Some of the sections that follow describe other applications of BOS files.