3.6 Build-Script Line Prefixes

Build-script line prefixes control some aspects of a build script's execution. The prefixes occur on a build script before the program name. The first nonprefix charac-ter ends the prefixes. The bar (|) prefix can also be used to mark the end explicitly. White space is allowed between prefixes, and between the prefixes and the program name. Build-script lines are macro-expanded before prefixes are detected, so you can use macros to define prefixes.

Do Not Echo the Build-Script Line (Silent Operation)

@

Usually omake echoes (displays) the build-script line to the screen before executing it. The @ prefix prevents this display except when running omake -n.
Here is an example of its use:
ERRS = make.out
$(OBJS) : $(.TARGETROOT).c
%do CCquiet
CCquiet :
@ %echo -n Compiling $(.SOURCE) ...
@ $(CC) $(CFLAGS) -c $(.SOURCE) >>$(ERRS) 2>&1
@ %echo done.
Redirection by >>$(ERRS) 2>&1 means error messages from the compiler go into the $(ERRS) file. The net effect is that a series of messages of the form:
Compiling file ... done.
are displayed and all output from the compiler is redirected into make.out.
See also the .SILENT target attribute to turn on silent mode for this target and the -s command-line option to enable silent mode for all targets.
@@

The @@ prefix prevents display of the build script before execution, even when running omake -n.

Ignore the Build-Script Line Exit Status

-[num]

Normally a build-script line that returns a nonzero exit status causes omake to terminate with this message:
omake: Shell line exit status exit_status. Stop
The dash (-) prefix causes omake to ignore the exit status returned from the build-script line and to continue. The message now becomes
omake: Shell line exit status exit_status (ignored)
If num is given, omake ignores the exit status if it is no greater than num. For example, the prefix -4 tells omake to ignore an exit status of 1, 2, 3, or 4. There must be at least one space after num.
Importantly, the status macro is set to the exit status of the build-script line so it can be tested later. See the -- prefix for an example.
See also the .IGNORE target attribute to turn on ignore mode for this target and the -i command-line option to turn on ignore mode for all targets.
--[num]

Ignores the exit status and does not display the warning message.
If num is given, omake ignores the exit status if it is less than or equal to num.
For example, the CCquiet target of the previous example can be changed to this:
CCquiet :
@ %echo -n Compiling $(.SOURCE) ...
@- - $(CC) $(CFLAGS) -c $(.SOURCE) >>$(ERRS) 2>&1
%if $(status) != 0
% abort FAILED! See $(ERRS) for errors.
%endif
@ %echo done.
Now a failed compile generates this message:
Compiling file ... FAILED! See make.out for errors.
~[num]

Ignores the exit status and displays the warning, but the status macro retains its current value and is not set to the exit status of this build script.
~~[num]

Ignores the exit status, does not display the warning, and retains status.

Override the -n Command-Line Option

&

Use & to override the -n command-line option for this build script. This prefix is useful if you are using omake to call itself recursively.
It is usually better to use the .MAKE target attribute instead because it overrides the -q and -t command-line options as well as -n.

Select the Shell Program

omake executes all build-script lines with the shell program. This default can be changed with the .SHELL directive, which selects use of the shell program, and the .NOSHELL directive, which selects direct execution.

The following prefixes override the general execution mode for the current build script:

:

Executes the build script directly.

+

Executes build scripts by the shell program.

Iterate the Build Script

!

Iterates the build-script line for each element of $? (i.e. $(.NEWSOURCES)) or $** (that is, $(.SOURCES)), on the basis of which appears first on the build-script line. The build-script line is executed once for each element of the original $? ($**) with the value of $? ($**) taking on successive elements of the original $? ($**).
If neither $? nor $** appears on the build-script line, the build-script line is iterated once for each element of $**.
omake performs iteration explicitly over any number of build scripts with its %foreach directive, and the use of the ! prefix is discouraged.

Miscellaneous Prefixes

|

The bar (|) prefix can be used to mark the end of the prefixes. This is useful when the command to be executed starts with one of the prefixes.
>

The right-angle bracket (>) prefix inserts an extra carriage return/linefeed after the build script is executed. This prefix is supplied for PM/CB compatibility.

Build Script Compatibility with Other Make Utilities

For PM/CB compatibility, omake supports named prefixes such as (Silent) and (Ignore).