NMAKE Help (nmake.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Environment-Variable Macros
◄Up► ◄Contents► ◄Index► ◄Back►
─────NMAKE──────────────────────────────────────────────────────────────────
NMAKE inherits macro definitions for every environment variable
that existed before the NMAKE session. If a variable was set in
the operating-system environment, a macro exists that has the same
name and value. Inheritance occurs before preprocessing.
Environment-variable macro names are in uppercase.
WARNING: If an environment variable contains a dollar sign
($), NMAKE interprets it as the beginning of a macro
invocation. The resulting macro expansion can cause
unexpected behavior and possibly an error.
Environment-variable macros can be redefined. However, the
following restrictions apply:
■ Changing a macro does not change the equivalent environment
variable. To change the variable, use a SET command.
■ Changing an environment variable in an NMAKE session using
the SET command does not change the corresponding macro; to
change the macro, use a macro definition.
If an environment variable has not been set, there is no
equivalent macro, and the variable cannot be set using a macro
definition. However, you can use a SET command in the NMAKE
session to set the variable. The variable is then in effect for
the rest of the NMAKE session unless redefined or cleared by a
later SET command. A SET definition in a makefile does not create
a corresponding macro; if you want a macro for an environment
variable that is created during an NMAKE session, you must
explicitly define the macro in addition to setting the variable.
The /E option causes macros inherited from environment variables
to override any macros with the same name in the makefile.
See: ◄/E Option►
◄Precedence Among Macro Definitions►
Environment-variable macros are inherited during recursion.
See: ◄Inherited Macros►
The !INCLUDE preprocessing directive uses the INCLUDE macro, which
is initially set to the value of the INCLUDE environment variable.
See: ◄!INCLUDE Directive►
Example
LIB = c:\tools\lib
sample.exe : sample.obj
LINK sample;
This makefile redefines the environment-variable macro called LIB.
No matter what value the variable LIB had before, it has the value
c:\tools\lib when NMAKE executes the specified LINK command.
Redefining the inherited macro does not affect the original
environment variable; when NMAKE terminates, LIB still has its
original value.
However, if LIB is not defined before the NMAKE session, the LIB
macro definition does not set a LIB environment variable for the
LINK command. To do this, use the following makefile:
sample.exe : sample.obj
SET LIB=c:\tools.lib
LINK sample;
-♦-