3.1 Command-Line Options

Command-line options or flags are indicated by a dash (-) or slash (/) followed by a one-letter option name. Some options take an argument and that argument follows the option name with or without intervening space. Several options can be grouped together after a single dash, but options that take an argument can only be at the end of the group. To signal the end of options, a double dash (--) can be used in case a command-line target or macro has a dash as the first character. Here are some examples:

omake -n -d -f project.mak -p
omake -ndpf project.mak
omake -f ../makefile -- -readme-

The first and second example are identical and show how options can be grouped. The third example shows the use of the double dash to indicate the end of options. This is required to prevent omake from interpreting -readme- as more options.

Initial Command-Line Parameters: OMAKEOPTS

Before parsing the command line, omake looks for the OMAKEOPTS environment variable and, if it is found, parses its value. After reading the initialization file, omake also parses the value of the MFLAGS macro for additional command-line parameters. MFLAGS can be defined on the command line, in make.ini or in the environment (but an MFLAGS definition in the makefile is ineffective). Using the -z command-line option causes omake to ignore MFLAGS. Setting MFLAGS in make.ini is strongly discouraged, because directives can be used instead. After the OMAKEOPTS environment variable is parsed, the command line itself is parsed.

The Command-Line Options

The options in Table 2 are parameters for omake's native mode. Many parameters are different for NMAKE and PolyMake emulation modes.

Table 2 omake Command-Line Options


Option

Meaning

-a


Updates all targets whether or not they are out of date. If no targets are specified on the command line, the default target is updated.



-A


Uses automatic dependencies. This option is enabled only if you are not using configuration lookup (because you are processing non-MVFS files or using the -W option).



-b file


Names file as the initialization (built-ins) file (The default is make.ini.) If file is the empty string, no initialization file is read. You can specify this on the command line with "-b<SPACE>", -b"<SPACE>" or -b<SPACE>"".

The value of the BUILTINS macro is set to the full pathname of file.



-d


Run-time debugging mode. A run-time trace of omake operation displays targets being made and rules being tried. See also the -p command-line option.



-D


Keep-directory mode. The first access of the current directory or any search directory to look for a file reads the directory into memory. Subsequent accesses to the directory use the in-memory version and are much quicker.



-e


Environment macro precedence. Macros defined from environment variables have a higher precedence than makefile macros.



-EN


Sets omake's emulation mode to NMAKE. Selecting this emulation causes the rest of the command line to be interpreted as an NMAKE command line. See Microsoft NMAKE Compatibility for more information.



-EO


Default emulation mode; that is, no emulation.



-EP


Sets omake's emulation mode to PM/CB. Selecting this mode causes the rest of the command line to be interpreted as a PM/CB command line. See PM/CB (Intersolv Configuration Builder and PolyMake) for more information.



-E2


Sets omake's emulation to Opus Make v5.2x. See Opus Make v5.2x Compatibility and Emulation for more information.



-f file


Specifies file as the makefile. More than one -f option may appear, and the files are read in order. omake first tries to read file, but if file does not exist, omake tries file.mak. If file is con or - the console is read for the makefile and <CTRL+Z>,<ENTER> (<CTRL+D> for UNIX) as the last input finishes the input.

If no -f options are specified, omake tries makefile and then makefile.mak.

The value of the MAKEFILE macro is the file of the first -f option.



-G


Restricts dependency checking to makefile dependencies only-those dependencies declared explicitly in the makefile or inferred from an inference rule. All detected dependencies are ignored. For safety, this option disables winkin of DOs from other views; it is quite likely that other views select different versions of detected dependencies.

For example, a derived object in your view may be reused even if it was built with a different version of a header file than your view currently selects. This option is mutually exclusive with -W.



-h


Displays a help screen showing the command-line syntax and command-line options. The current emulation mode determines the help that is displayed.



-i


Ignores exit status, which causes the nonzero exit status from any build scripts to be ignored. This option can be used to collect all errors into a single file without stopping omake. See also the -k option.

Many compilers send their error messages to standard error. This command-line option redirects standard error either into a file or to the standard output. With it, the command

omake -i -x - > errs

collects all messages into the errs file. See the -x command-line option.



-k


Keep-working mode. Any errors when updating a target cause work on that target to be stopped, but the make process continues. Because the target was incompletely made, any other targets that depend on it are prevented from being updated.

This mode is handy for long, unattended builds because it maximizes the amount of making without completely ignoring the exit status as the -i command-option does.



-L


Disables configuration lookup and config record creation. See also clearmake -F.



-M


Makes makefile. omake makes the makefile before reading it. See the section Makefile Directives.



-n


No execute. Displays, but does not execute, the build scripts that update the targets. This option is useful for debugging makefiles and for showing the work that will be done. To override this option for a recursive make, use the .MAKE target attribute (see Target Attributes) or & shell-line prefix (see Build-Script Line Prefixes).



-O


Disables build script checking during configuration lookup.



-p


Prints debugging information to screen. Macros are listed with their location of definition and value; search directories are indicated; inference rules are displayed and targets, build scripts and attributes are printed. The interpretation of the output is discussed in Chapter 4, Debugging Makefiles.



-r


Rejects inference rules. omake ignores inference rules that are built in and that are defined in the initialization file. Only inference rules defined in the makefile are used.



-s


Silent mode. Build scripts are usually displayed before they are executed. The -s option prevents this display.



-T


Examines sibling derived objects when determining whether a target object in a VOB can be reused (is up to date). By default, when determining whether a target can be reused, omake ignores modifications to objects created by the same build rule that created the target (sibling derived objects). -T directs omake to consider a target out of date if its siblings have been modified or deleted. -T is equivalent to clearmake -R.



-v


Increases output verbosity during the build process (particularly with respect to configuration lookup and config record creation).



-W


Disables shopping for derived objects to wink in. -W is equivalent to clearmake -V.



-x file


Redirects error messages into file. As a special case, if file is -, the error messages are redirected to the standard output. For example:




omake -x make.err

omake -x - >> make.err


(errors go into make.err)

(errors are appended to make.err)


-z


Ignores MFLAGS. The MFLAGS macro is not examined for additional options.



-#1


Debugging option-read-time debugging mode. A read-time trace of omake operation displays makefiles being read and conditional directives being interpreted. See Chapter 4, Debugging Makefiles for an interpretation of the -#1 output.



-#2


Debugging option-warns about undefined macros. When omake tries to expand the value of a undefined macro, it displays a warning message. The default action is to silently ignore undefined macros.



-#4


Debugging option-warns about unrecognized makefile lines. When omake reads a line in a makefile it can't understand, it displays a warning message. The default action is to silently ignore unrecognizable makefile lines.



-#8


Debugging option-leaves behind generated response files and batch files. omake uses several temporary files, which are usually deleted before omake quits. This option causes omake to leave them behind so they can be examined.


Debugging features can be specified as a sum or as a comma-separated list. For example, both -# 7 and -# 1,2,4 display makefile lines, warn about undefined macros, and warn about unrecognized makefile lines). See also the description of the .DEBUG directive in the section Dot Directives.

The Current Options

After reading its initialization file, omake exports all command-line options except -b and -f into the MFLAGS macro (unless you are using omake in an emulation mode). Also, the state of each command-line option is kept in the macros listed in the section Predefined Macros: State Macros and in Appendix C, Built-In Macros and Rules.