Define a Make Utility Macro

Before using a macro, you need to define it, either on the command line or in your description file.

In a description file
Description-file macro definitions look like this:

macroname = macrostring

Macro names can be any combination of alphanumeric characters and the underscore character (_), and they are case-sensitive. A macro string can be any string of characters or a null string.

The first character of the macro name must be the first character on the line. The Make utility ignores any spaces before or after the equal sign (=).

The macro string can be a null string and can contain embedded spaces. Do not enclose the macro string in quotation marks; quotation marks are used only when you define macros on the command line.

On the Command Line
Before using a macro, you need to define it, either on the Make utility command line or in your description file. Command-line macro definitions look like this:

macroname=macrostring

No spaces can surround the equal sign. If you embed spaces, the Make utility might misinterpret your macro. If your macro string contains embedded spaces, enclose it in double quotation marks (") like this:

macroname="macro string"

or simply enclose the entire macro definition in double quotation marks (") like this:

"macroname = macro string"

Macro Syntax
After you have defined a macro, you can use it anywhere in your description file with the following syntax:

$(macroname)

The parentheses are not required if the macro name is only one character long. To use a dollar sign ($) without using a macro, enter two dollar signs ($$), or use the caret (^) before the dollar sign as an escape character.

When the Make utility runs, it replaces all occurrences of $(macroname) with the defined macro string. If the macro is undefined, nothing is substituted. After a macro is defined, you can cancel it only with the !UNDEF directive.

Example of a Make Utility Macro

program = FLASH
c = LINK
options =

$(program).EXE : $(program).OBJ
  $c $(options) $(program).OBJ;

The example above defines three macros. The description block executes the following commands:

FLASH.EXE : FLASH.OBJ
   LINK FLASH.OBJ

 



Make Utility Macros


Substitution in a Macro


Make Utility Macro Precedence Rules
Predefined Make Utility Macros