NMAKE Macros Cannot Expand to Mutiple Command Lines

ID Number: Q70146

1.00 1.01 1.10 1.11 1.12 | 1.01 1.10 1.11 1.12

MS-DOS | OS/2

Summary:

Using a single macro to substitute for multiple command lines is not

possible in an NMAKE description file (makefile). Attempting to use

one macro to represent multiple commands only results in the macro

expansion being treated as one long concatenated command.

More Information:

It is possible to have many description blocks, which have many of the

same command sequences, within in an NMAKE description file. It would

be useful to be able to use a macro in place of multiple commands that

are shared between description blocks.

For instance, you might attempt something similar to the sample NMAKE

makefile below. The intent of this simplified example is to have the

macro expand to perform a Cls (clearscreen) and then a Dir command. In

actual practice, the Dir command is ignored because the actual command

passed to the operating system is the following

CLS <cr/lf> DIR

where <cr/lf> is a carriage return/line feed.

One method that does work to avoid repetition of many command

sequences within your description file is to create a batch file with

the necessary commands to be called whenever those commands are

needed. In addition, under OS/2, multiple commands can be specified on

the same line by separating them with an ampersand (&).

Sample NMAKE Description File

-----------------------------

# This description file attempts to clear the screen and do a

# directory listing with both commands in a single macro, but

# the Dir command is ignored.

CMDS=CLS ^

DIR

showdir:

$(CMDS)