Previous Next

Using Macros and Environment Variables

The Build utility uses numerous environment variables and macros:

Here, MacroValue represents a text string that the Build utility uses to replace MACRONAME in its internal scripts. To specify a MacroValue string that is longer than one line, end each line except the last with a backslash (\) character.

The distinction between environment variables and macros is weak, because some environment variables can be referenced or changed within sources files, and some macros can be defined as environment variables in the build environment window. However, it is recommended that you not attempt to interchange environment variables and build macros in this manner.

Controlling Environment Variables and Macros

To see the value of all Build utility environment variables, type set in a build environment command window. The set command can also be used to change a variable's value.

To reference an environment variable or macro in a sources file, use the following syntax:

$(VariableName)

where VariableName is the name of the environment variable or macro. An example is as follows:

TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
           $(SDK_LIB_PATH)\advapi32.lib \
           $(SDK_LIB_PATH)\user32.lib   \
           $(SDK_LIB_PATH)\spoolss.lib

For a complete list of the required and optional environment variables and macros, see Build Utility Environment Variables and Build Utility Macros.

Note  Except for the DIRS and OPTIONAL_DIRS macros, which are used by the Build utility, these macros are all used by NMAKE. All that the Build utility does is open all the files, figure out the dependencies, and then call NMAKE. The other macros used in the build process are all used by NMAKE. For information on the DIRS and OPTIONAL_DIRS macros, see the dirs file.