Search code examples
nmake

How to see built-in rules with nmake?


With GNU make one can say make -npf /dev/null (or on Windows NUL) in order to show the built-in rules. Where -n means --just-print, -p means --print-data-base and -f specifies the make file to use.

How can I achieve the same with nmake?


Solution

  • The command nmake -p will, when entered in a folder with no makefile, give a list of environment variables, followed by a list of the built-in rules:

    INFERENCE RULES:
    
    .asm.obj::
            commands:       $(AS) $(AFLAGS) /c $<
    
    .asm.exe:
            commands:       $(AS) $(AFLAGS) $<
    
    .c.obj::
            commands:       $(CC) $(CFLAGS) /c $<
    
    .c.exe:
            commands:       $(CC) $(CFLAGS) $<
    
    .cc.obj::
            commands:       $(CC) $(CFLAGS) /c $<
    
    .cc.exe:
            commands:       $(CC) $(CFLAGS) $<
    
    .cpp.obj::
            commands:       $(CPP) $(CPPFLAGS) /c $<
    
    .cpp.exe:
            commands:       $(CPP) $(CPPFLAGS) $<
    
    .cxx.obj::
            commands:       $(CXX) $(CXXFLAGS) /c $<
    
    .cxx.exe:
            commands:       $(CXX) $(CXXFLAGS) $<
    
    .rc.res:
            commands:       $(RC) $(RFLAGS) /r $<
    
    .SUFFIXES: .obj .asm .c .cc .cpp .cxx .f .f90 .for .rc
    

    This is also at https://learn.microsoft.com/en-us/cpp/build/reference/inference-rules.

    See nmake /? for other switches, such as -n. Also see my answer here for some useful references to the older nmake documentation.