Creating NMAKE Inference Rules for Nonstandard File Extensions

ID Number: Q81454

1.10 1.11 1.12 1.13 1.210 | 1.10 1.11 1.12 1.13 1.20

MS-DOS | OS/2

Summary:

When using NMAKE to create an Inference Rule for a file with a

nonstandard file extension (for example, not .C, .BAS, .ASM, and so

forth), you must specify the name of the new extension in the

.SUFFIXES list.

More Information:

It is sometimes necessary or desirable to compile a source file with a

nonstandard file extension. For example, you may want your QuickBasic

source-code file to be named TEST.SRC rather than the standard

TEST.BAS. When compiling this file using NMAKE, you can create a new

Inference Rule for that extension. The following is an Inference Rule

to compile a source file with a .SRC extension that is out of date

with respect to the target:

.src.obj:

@echo Compiling Source File

bc $<;

This is not enough, however, to get NMAKE to recognize the .SRC

extension. The name of the extension must be placed in the .SUFFIXES

list, which will alert NMAKE to recognize this extension. Otherwise,

NMAKE will gracefully glide past your compile statement without giving

an error. The following is the syntax for placing the .SRC extension

in a makefile:

.SUFFIXES: .src

The following is a listing of a complete NMAKE file to compile the

Basic source file TEST.SRC, which is out of date with respect to

TEST.OBJ:

.SUFFIXES: .src

.src.obj:

@echo Compiling Source File

bc $<;

test.obj:test.src

Additional reference words: 1.10 1.11 1.13 1.20 1.210