C.3 Inference Rules

The following list of rules have been predefined in omake and are available unless you use the -r command-line flag or .REJECT_RULES directive.

Notice how the rules make use of macros. For example, the %.obj : %.c rule invokes the program $(CC) with the flags $(CFLAGS). In your makefile, set CFLAGS to the flags to be passed to the compiler.

C source to object file, using the Microsoft C/C++ compiler:

CC = cl

Windows NT

%.obj : %.c

$(CC) $(CFLAGS) -c $(.SOURCE)

C++ source to object file, using the Microsoft C/C++ compiler:

CPP = cl

Windows NT

%.obj : %.cpp

$(CPP) $(CPPFLAGS) -c $(.SOURCE)

Assembler source to object file, using Microsoft MASM:

AS = masm
.%.obj : %.asm
$(AS) $(AFLAGS) $(.SOURCE);

FORTRAN source to object file, using Lahey FORTRAN:

FC = f77l
%.obj : %.for
$(FC) $(.SOURCE) $(FFLAGS)

Resource compiler script to resource file, using the Microsoft Resource Compiler:

RC = rc
%.res : %.rc
$(RC) $(RCFLAGS) -r $(.SOURCE)

Update an executable, using Microsoft link32 for Windows NT:

LINK = link
%.exe :
$(LINK) -OUT:$(.TARGET) $(LINKFLAGS) $(.SOURCES) $(LINKLIBS)

Object file to executable, using the %.exe rule:

%.exe : %.obj
%do %.exe

Update a library, using Microsoft lib for Windows NT:

IMPLIB = lib
%.lib :
%if ! %null(.NEWSOURCES)
% if %file(${.TARGET})
$(IMPLIB) -OUT:$(.TARGET) $(LIBFLAGS) $(.TARGET) $(.NEWSOURCES)
% else
$(IMPLIB) -OUT:$(.TARGET) $(LIBFLAGS) $(.NEWSOURCES)
% endif
%endif

Compatibility with Other Make Utilities

The ccase-home-dir\builtins.cb and ccase-home-dir\builtins.nm files define the inference rules used by PM/CB and NMAKE, respectively. omake reads these files when PM/CB or NMAKE emulation is chosen; it searches for these files in the same manner in which it searches for the make.ini file (see Locating the Initialization File).