Invoking NMAKE with /A Still Evaluates First Target Only

ID Number: Q73690

1.00 1.01 1.10 1.11 1.12 1.13 | 1.01 1.10 1.11 1.12 1.13

MS-DOS | OS/2

Summary:

The Microsoft NMAKE File Maintenance utility will only evaluate the

first target in a makefile, even if the /A switch is used. This may

not be readily apparent from the documentation, which states that the

/A switch causes NMAKE to rebuild all requested targets, even if they

are not out of date with respect to their dependents.

More Information:

In the sample makefile below, NMAKE will invoke the compiler to

produce HELLO1.OBJ and then stop. The /A switch will force NMAKE to

recompile HELLO1.C even if HELLO1.OBJ is more recent, but does not

recompile and relink all of the targets in the makefile.

This behavior is documented in section 6.9 of the "Microsoft C

Advanced Programming Techniques" manual that ships with Microsoft C

versions 6.0, 6.0a and 6.0ax, and section 10.10 of the "Microsoft

Macro Assembler Programmer's Guide" that ships with Microsoft Macro

Assembler (MASM) version 6.0.

To force NMAKE to evaluate each target, a pseudotarget may be

specified as the first target in the makefile. The pseudotarget is

given all the other actual targets as dependents. An example is the

"ALL" pseudotarget in the sample makefile below. Uncomment that line

to force both targets to be built. For more information, see the NMAKE

documentation or query on the following words:

nmake and pseudotarget and default

Sample Makefile

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

# ALL : hello1.exe hello2.exe

hello1.obj : hello1.c

hello2.obj : hello2.c

hello1.exe : hello1.obj

hello2.exe : hello2.obj

Additional reference words: 1.0 1.00 1.01 1.1 1.10 1.11 1.12 1.13