This section describes the events that occur when you invoke omake.
At read time, omake parses the command line, reads the initialization file, and reads one or more makefiles. Steps in the start-up process:
If the OMAKEOPTS environment variable exists, it is parsed for command-line parameters.
The command line is parsed.
The initialization file is found and read.
If the MFLAGS macro is defined and the -z command-line option was not specified, the macro is expanded and parsed as a command line.
Each makefile is read in the order it appears on the command line.
omake reads the initialization file and makefiles, collecting macro definitions, dependency lines, rules, and build scripts. Dependency lines are built into a set of dependency trees, with each target node connected by a dependency arc to each of its dependency nodes. Because each dependency is itself a target, it is connected to its own dependencies. At the leaf nodes of the trees are targets without any dependencies.
At run time, omake makes the command-line targets or, if none are specified, the first normal target in the first makefile. In this context, "normal" means not a directive, special target, attribute, or inference rule. This first normal target is called the default target. Briefly, these are the steps involved in making a target:
Locate the target.
Look for the target as a file on disk and, if found, record its location.
Make its dependencies.
Make the target's explicit dependencies.
Locate its inferred dependency.
If the target has no build scripts, use inference rules to look for an inferred dependency. If the inferred dependency is found, add it as a dependency of the target and add the rule's build scripts to the target. Then, make the inferred dependency.
Compare and update the target.
omake's build avoidance scheme includes automatic dependency detection. By default, omake uses configuration lookup to compare the configuration record of the target to your build configuration and determine whether a build is required. If the targets are not in a VOB, omake compares time stamps to determine whether a build is necessary. If the time stamp of any target dependency is more recent than that of the target itself, the target is updated by executing its build script. After the build scripts have been executed, the target is made.
If the target was found in Step #1, omake assumes its location stays the same. If the target was not found, omake makes a second attempt to locate it on disk. In either case, omake also updates its internal copy of the target's time stamp.
The consequence of Step #2 and Step #3 is that omake makes a target's dependencies recursively. omake goes as far as it can down the dependency tree and works back up, using configuration record matching and build avoidance, as described in Step #4. If the target is not in a VOB, omake checks the time stamp of the target against its dependencies. For targets that have at least one newer dependency, the target's build scripts are executed to update the target.
The utility of Step #3 is that it generalizes the make process. Inference rules are akin to statements such as "all .obj files can depend on like-named .c or .cpp files."
An extensive example that shows the read-time steps in the make process is in Chapter 4, Debugging Makefiles.
Before making any targets, omake executes the build scripts of the .BEFORE special target if it is defined.
Immediately before exiting, omake executes the build scripts of the .AFTER special target if it is defined. omake then removes any temporary files it has created and exits.
If the target is not in a VOB, omake updates its internal copy of a target's time stamp after the target has been made. The value the time stamp is set to is determined as follows:
If the target has build scripts, the time stamp is set to the current system time after all build scripts have been executed.
If the target has no dependencies, the time stamp is set to the current system time.
Otherwise, the time stamp is set to the most recent of the target's current time stamp and those of all its dependencies.
Feedback on the documentation in this site? We welcome any comments!
Copyright © 2001 by Rational Software Corporation. All rights reserved. |