Nokia nmake 16 MAKERULES(1)


makerules − default nmake base rules


rules "makerules"


makerules are the default nmake base rules. The nmake engine is described in nmake(1).

Base rules define the local nmake operating environment. Base rules files are like normal nmake makefiles in most respects, with the exception that they are explicitly written to be shared among a varied group of users. makerules defines a collection of options, operators, common target atoms, metarules and variables suitable for the UNIX programming environment.

In the following descriptions, lhs and rhs are the lists of atoms appearing on the left and the right side of the operator, and action is the action following the operator.


The main source dependency operator. lhs is a single command or archive target that is built from the source files in rhs. If the lhs is an archive then $(LIBDIR) :INSTALLDIR: lhs is asserted, otherwise $(BINDIR) :INSTALLDIR: lhs is asserted (see Directories). If the lhs is not given, then the rhs is appended to the list of files for the save-oriented common actions, such as cpio, tar, etc. (see Common Actions).


Causes the rhs targets and all :: targets to be made when no command line targets are specified.


The lhs is a variable whose value is the result of shell command substitution on the action with respect to prerequisites on the rhs.


The lhs is a copy of the rhs file.


The lhs is a functional variable, whose value is determined by the action during the execution time. For example,


is the same as



If the lhs is omitted then the rhs is added to the list of targets made by the install common action. Otherwise the lhs is installed by the install common action by copying the file on the rhs. If the rhs is omitted then the lhs is installed from the file named by the base and suffix of the lhs file name. If both the lhs and rhs are omitted and an action is specified then this overrides the default install action. The default install action saves old install targets in target.old.


The files in the rhs are installed into the directory on the lhs by the install common action. Any default installation of these targets by the :: and :LIBRARY: operators into BINDIR, LIBDIR, etc. is overridden. If the lhs is omitted any default installation of the files into BINDIR, LIBDIR, etc. is suppressed, however any explicitly specified installation of these targets elsewhere will still take place.


The files which match the edit operation specified on the rhs are installed in the directory specified on the lhs. For example,


will install all generated files with the user-defined attribute .SQLFORM in $(FORMDIR).


This assertion operator installs $(PROTO) output of rhs into lhs directory by the install common action. The program $(PROTO) converts a prototyped C file to a single file that is compatible with the ANSI, K&R and C++ dialects of C. rhs files must have #pragma prototyped as the first line and must be valid ANSI C.


The action jointly builds all targets on the lhs with respect to prerequisites on the rhs.


This operator creates a library from the specified source files. The syntax is:

name [ major.minor [required-libraries]] :LIBRARY: source

where name is the name of the library (e.g., x for libx.a), major.minor is the version number for shared libraries if the compiler of the specific machine supports it, required-libraries are the libraries that have to be linked in conjunction with the current target library, if there are any (see .REQUIRE.pattern of nmake(1)), and source is the list of source files. If required-libraries are specified, nmake will generate a file $(LIBDIR)/lib/name, containing the names of the required-libraries for the target library. For example,

cs 1.0 nsl socket :LIBRARY: standalone.c

Here cs is name, 1.0 is major.minor, nsl socket are required-libraries, and standalone.c is source. $(CCFLAGS) controls the file name of the archive. If $(CCFLAGS) is set to −g, then the library is named libname−g.a (e.g., libx−g.a). If $(CCFLAGS) is set to −p, then the library is named libname−p.a (e.g., libx−p.a). If $(CCFLAGS) is set to −pg, then the library is named libname−pg.a (e.g., libx−pg.a). If $(CC.PIC) is in $(CCFLAGS), then both libname.a and are created. :LIBRARY: makes .a only by default, even if CCFLAGS+=$$(CC.PIC) is on. The all or install common actions also generate the shared library (.so on SVR4).


The lhs files are hard links to the rhs file. Works properly with the install common action.


If the rhs is a directory then a recursive nmake is run in that directory. If rhs is not specified then a recursive nmake is run in all subdirectories containing a makefile from the list $(MAKEFILES:/:/ /G). The directories are created in the top node as needed if a corresponding directory and makefile exists in the viewpath (see variable recurse_mkdir). The lhs can be specified as label targets.


Facilitates locating the include files and libraries of certain packages. It can also be used with the PACKAGE_ID, PACKAGE_ID_INCLUDE, and PACKAGE_ID_LIB environment variables that add to the list of directories to be searched for include files and libraries. For example, if one owns and builds the X11 tools and libraries, which are installed in /usr/add-on/X11, an nmake makefile with


will search for include files by adding −I/usr/add-on/X11/include and for libraries by adding −L/usr/add-on/X11/lib and −lX11 to the linker options (see cc(1) and ld(1)). Other X11 versions, e.g., /home/my/X11, can be accessed by exporting the PACKAGE_ID[_INCLUDE|_LIB] environment variable:

export PACKAGE_X11=/home/my/X11

:PACKAGE: and PACKAGE_ID[_INCLUDE|_LIB] eliminate the need for many .SOURCE.a and .SOURCE.h makefile assertions.
Note, :PACKAGE: changes INCLUDEDIR to be $(INSTALLROOT)/include/ID by default. If using a third party software package, specify it as


The "" at the beginning of the rhs inhibits the INCLUDEDIR redefinition.
can be multiply defined, but the most recent :PACKAGE: assertion takes the highest precedence. A "+" in the rhs will append the package at the end of the package list, which means it will take the lowest precedence.


The rhs compilation is to place tables and/or data in a readonly text object section. Only the parse and pattern tables are placed in readonly for yacc(1) and lex(1) files. :READONLY: will become a no-op when enough C compilers properly implement const.


The rhs files are generated but are still to be saved by the save-oriented common actions (cpio, pax, etc.).


The rhs files are compiled using $(cc) instead of $(CC). This is useful for compiling C and C++ modules from the same makefile.

Common Actions
defines several common command line actions. In the following, main-target is the name of the target in the first :: assertion.


Make all :: targets.


This common action assumes the existence of one or more cc−opt (or cc+opt) subdirectories, where opt is any valid CCFLAGS value (e.g., g, p, pg, etc.). When nmake is invoked with cc−opt (or cc+opt), nmake builds the makefile in the corresponding subdirectory with the specified options for CCFLAGS. Multiple options may be specified by using a tilda (~) to separate each option (e.g., cc-g~+eh~-xtime).


Similar to cc−|+, except that specified compiler options append to the value of CCFLAGS rather than replace it.


Generates the database files for the C information abstractor cia(1).


Generates a dot(1) input call graph file based on information generated by the ciadb common action


All generated intermediate files are removed. Command and archive files are retained.


All generated files, except the output of the cpio, pax, shar, and tar common actions, are removed.


Removes all of the files installed by the install common action.


All source files are copied to the cpio(1) archive named main-target.cpio.


Runs ctags(1) on all C-related source files whose name matches *.[cfhly].


Runs the grindex common action plus runs vgrind(1) on all C-related source files whose name matches *.[cfhly]. The output is sent to $(LPR).


Generates a vgrind(1) index on all C-related source files whose name matches *.[cfhly]. The output is sent to $(LPR).


All ::, :INSTALL:, :INSTALLDIR:, :INSTALLPROTO: and :INSTALLMAP: target files are built and installed in the directory hierarchy rooted at $(INSTALLROOT) (see Directories) or in the specified directories.


lint(1) is run on all C-related source files. The proper −D and −I options are propagated to lint.


Lists the files which have been generated.


Lists the files and directories to be installed and created under $(INSTALLROOT) by the install common action. The files and directories are listed relative to $(INSTALLROOT). The install common action does not need to be run first.


Lists the source files.


Lists the sorted archive symbol names for each archive that has already been built.


Moves all source files in the top view of the viewpath down to the next view. A file named OFFICIAL is created in the current directory logging the moved files and the date.


All source files are copied to the pax(1) archive named main-target.pax.


All source files are sent to $(LPR) via $(PR).


When using :MAKE:, certain common actions (such as clean, clobber, official) are non-recursive by default. When recurse is asserted before a common action, recursion is forced (e.g., nmake recurse clobber).


All source files are copied to the shar(1) archive named main-target.shar.


All source files are copied to the tar(1) archive named main-target.tar.


All source files modified since the last uprint are sent to $(LPR) via $(PR).

imposes the use of the new C preprocessor for all C compilations by overloading CCFLAGS with the proper incantations. In some cases the shell script wrapper $(PPCC) will be run for compilers that have cpp built in. This ensures that "..." include files follow the local files override non-local files rule. The native C preprocessor can be made the default by placing nativepp=1 in an nmake alias or by exporting nativepp=1 in the environment. Doing this, however, may defeat some or all of the benefits of the .SOURCE* binding rules and/or viewpathing where "..." include files are concerned. Setting nativepp=−1 inhibits the warning message about overriding the nmake C preprocessor.

Metarules perform common language file transformations. nmake can be used to manufacture software applications written in a variety of languages: C, C++, assembler, FORTRAN, yacc, and so on. The language support is: *.c → *.o, *.y → { *.c, *.h }, etc.

Scan Rules
supplies the following default scanning strategies:
.x [dynamic attribute]

Marks an atom (when bound to a file) to be scanned for implicit prerequisites using the .x scan strategy. .ATTRIBUTE.pattern : .SCAN.x is asserted for each of the strategies listed below.

Scans for C #include file prerequisites and candidate state variable references. Include statements requiring macro substitutions are not recognized. "..." include files are bound using the directories of .SOURCE first and then the directories of .SOURCE.h. This is the opposite of the default directory binding order. <...> include files are bound using only the directories of .SOURCE.h. "..." include files are assigned the .LCL.INCLUDE attribute and <...> include files are assigned the .STD.INCLUDE attribute. .LCL.INCLUDE takes precedence if a file appears as both "..." and <...>.
To support popular C coding style, if an including file is included as "prefix/includer" then a file "includee" included by "prefix/includer" is first bound using "prefix/includee", and, if that fails, is next bound using "includee".


FORTRAN include and INCLUDE file prerequisites.


A combination of the .SCAN.c, .SCAN.f, and .SCAN.sql strategies.


Scans for IDL #include file prerequisites and candidate state variable references.


m4(1) include(...), sinclude(...), and INCLUDE(...) file prerequisites. The INCLUDE(...) form also handles S (statistical analysis package) source file prerequisites. Include statements resulting from macro substitutions are not recognized.

nmake include file prerequisites.


nroff(1) and troff(1) .so file prerequisites. Only .so file starting at the beginning of a line is recognized. .so statements requiring macro substitutions are not recognized.


RATFOR include and INCLUDE file prerequisites. Include statements requiring macro substitutions are not recognized.

Scans for candidate state variable references, i.e., those state variables initialized with the == operator.


SQL include file prerequisites of the form EXEC SQL include filename or ## include filename, where filename is "filename", filename;, or filename. SQL include file prerequisites can also be of the form $ include filename, where filename is <filename>, "filename", ´filename´, filename;, or filename.

Common directories are named by variables. The directory hierarchy is modeled after /usr in System V.

The root installation directory used by the :INSTALL: operator and install common action.


The installation directory for generated commands.


The installation directory used for generated miscellaneous system files.


The installation directory used for ksh functions.


The installation directory for generated header files.


The installation directory for generated libraries and data files.


The installation directory prefix for man(1) pages. *.nnn man page files are installed in the $(MANDIR)nnn directory.


The installation directory accessed by all hosts of the local network.

TMPDIR = /usr/tmp

The temporary file directory.

Each command referenced by the base rules has a corresponding command and option variable. For a command cmd the command is named by $(CMD), the options are named by $(CMDFLAGS) and the command is executed by expanding $(CMD) $(CMDFLAGS) arguments.

Base Rule Variables
The following variables are defined and used by the base rule operators and common targets. $MAKE_OPTIONS can be used to set these variables in the environment.
action_tag_begin, action_tag_end

These variables define shell commands to generate begin and end tags around each triggered shell action. The variables expand in the shell command stream before and after target action execution, so they should expand to arbitrary shell commands outputting the desired tags. Rule-specific dynamic values, such as $(<), and dynamic shell based substitutions, such as $(uname -n), are available. Both nmake based and shell based value expansions are most useful when properly escaped or quoted to delay evaluation until action trigger time. The variables are null by default. If environment variable makelog_format has a value xml or a value beginning with xml:, these variables default to values outputting XML tags.


This variable may be used to specify how many directory levels up from the current directory to look for include and archive directories (e.g., ancestor=2 is equivalent to .SOURCE.h : ../include ../../include and .SOURCE.a : ../lib ../../lib).

ancestor_list, ancestor_source

Determine lib and include directories used with ancestor. The default value of ancestor_list includes the default search directories (i.e. include, lib):

ancestor_list = $(ancestor_source) .SOURCE.a lib .SOURCE.h include

The default for ancestor_source is null. ancestor_list can be redefined to any list of .SOURCE.x search_dir_name_for.x pairs. For example, to search for headers only in the directory called hdrs and search for libraries only in the directory called LIB using the ancestor concept, one would redefine ancestor_list to be:

ancestor_list = .SOURCE.h hdrs .SOURCE.a LIB

To keep the default directories in the search path, one would redefine ancestor_source only.


Controls the removal of the generated (e.g., .o) files of an archive target after it is made. The value of arclean is a list of edit operations. Archive members matching the edit operations are removed after the archive target is made. For example, if one is making library libx.a from a list of C files and arclean=N!=x.o, all the .o files except x.o are removed after libx.a is made.


$(CC) is normally used to determine the probe configuration file to be used. $(cctype) may be used to specify that another C compiler’s probe file is to be loaded instead.


List of files and/or shell patterns to be removed by the clean common action in addition to those removed by default.


List of files and/or shell patterns that should not be deleted by clean common action.


List of files and/or shell patterns to be removed by the clobber common action in addition to those removed by default.


List of files and/or shell patterns that should not be deleted by clobber common action.


If $(clobber) is non-null the default install action will not move old install target to target.old.


If $(compare) is 0, then the default install action will not do a cmp −s before installing the target file.


When the disableautomaticprobe option is enabled and probe(1) needs to be triggered, the value of disable_probe_message is emitted as a warning or error message. disable_probe_message is set as "ERRORLEVEL custom_message", where an ERRORLEVEL of 2 or less issues a warning, and an ERRORLEVEL greater than 2 issues an error. The message can be suppressed by setting this variable to null.


If this variable is set, it will cause the re-link of a.outs with shared libraries (if it is not set, shared libraries time stamps are ignored).


If implicit_include=1, nmake will attempt to emulate commonly used C++ implicit template definition search rules and automatically set up the required implicit header file dependencies. However, complete emulation of compiler implicit search rules cannot be guaranteed. The only foolproof approach is suppression of the compiler implicit include feature and use of explicit #include directives.


Defines the warning to be printed when the C++ implicit include feature is in effect, and the compiler provides some way to suppress this feature. The warning may be suppressed by setting this variable to null.


This variable currently supports the following software packages: insight, quantify, purecov, purify, sentinel, insure and codewizard. When instrument is set to one of these packages, nmake builds targets with that package.


Defines the warning to be printed when the compiler supports flags for incorporating compiler supplied libraries and such a flag is included in CCFLAGS. The warning may be suppressed by setting the variable to null.


For install targets where the basename matches the pattern in $(link), the install action will attempt to link instead of copy (e.g., link=lib*).


If localprobe=vpath, then probe(1) information is assumed to be at a level relative to the current viewpath. If none exists, then local probe information files (and their relative hierarchies, if required) will be created in the top node of the viewpath. If localprobe is an alternate non-null setting, then the colon-delimited set of directories specified in the variable PROBEPATH will be used for probe(1) information. If no probe information is found in the directory roots of the PROBEPATH, then it will be generated in the first directory listed in the PROBEPATH.


Provides control over the format of structured build logs such as those generated by the xmakelog command. It is used to select attributes of triggered targets (tg elements) and control explain data (es elements) for inclusion in generated output. For details see the Nokia nmake Reference Manual.


If $(nativepp) is non-null, then the native C preprocessor will be used for compiling C source. The default nmake C preprocessor provides viewpath support.


This variable may be used to override the default common action output file base name.


This variable is 3D File System related (see 3d(1)). When physical is set, it will limit the recursion to directories which physically exist.


This variable is used to support C #include "file.h" compatibility. With prefixinclude=1 (default), the following scenario is valid:

Contents of main.c #include "subdir/file1.h"
Contents of file1.h #include "file2.h"
Contents of makefile .SOURCE.h: dir
Both file1.h and file2.h are located in dir/subdir.

nmake (invoked from the above dir level) looks first in dir/subdir to find file2.h. If file2.h is not found in dir/subdir, the default search rules are used. Note, you do not need to specify dir/subdir as a searching directory for .SOURCE.h to find file2.h, subdir prefix is inherited from the including file file1.h. With prefixinclude=0, nmake relies exclusively on the default search rules. (In this case you need to specify .SOURCE.h: dir dir/subdir to find file2.h).


When set to non-null value, the install common action will rename old install target to filename.#inode. This is useful for installing executables that may be currently running.


Causes a warning or error to be issued for #include "..." directives detected inside the viewpath, when the viewpath contains more than one node, to enforce the exclusive use of #include <...> directives. Useful when the compilation tools do not natively support the −I− preprocessor option and for some reason the nmake preprocessor cannot be used. The variable is set as, quoteinclude = 1|2|3 [prefix] where 1, 2, or 3 is the error level corresponding to the nmake error statement, and the optional prefix parameter restricts the warnings or errors to include files that inherit a directory prefix (see prefixinclude).


This variable specifies the maximum number of recursive makes that may be done concurrently when using the :MAKE: operator. The default is 1. Note that the NPROC environment variable or the jobs command line option determine an upper bound for recurse, meaning that if they are set to a value less than $(recurse), the number of concurrent makes will be bound by this value.

recurse_begin_message, recurse_end_message

Specifies a text message for recursing into a directory or file. There are three distinct recurse message types: default, gnu, and custom. recurse_begin_message = default provides traditional nmake style recurse messages. recurse_begin_message = gnu provides GNU make compatible recurse begin and end messages. The custom recurse messages allow user specification of the recurse begin and end message format. The value of $(recurse_begin_message) is printed when nmake recurses into a subdirectory or to a makefile, and the value of $(recurse_end_message) is printed when nmake returns from a subdirectory or makefile.


Controls the :MAKE: feature of creating missing recurse directories in the top viewpath node. When set to 1, the default, the feature is enabled and recurse directories are created in the top node as needed. When set to -1 or silent the feature is enabled and the mkdir shell trace is suppressed. When set to 0 (or null) the feature is disabled and recurse directories must already exist in the top node. See also the :MAKE: operator.


This variable may be set to a list of files that should be saved by the save common actions (in addition to the normal list of source files).


This variable can be set to a string of edit operators that are applied to the list of source files before the save common actions execute (e.g., select=N!=*.c will prevent any .c files from being saved).


Allows job action blocks to be piped to a job distribution utility such as Sun Grid qrsh. Each triggered action block is piped to a separate invocation of qrsh or other distribution utility. To enable the feature set sge_qrsh=1. The QRSH variable defines the job distribution utility command (default: QRSH = qrsh). The QRSHFLAGS variable defines the command line flags (default: QRSHFLAGS += -cwd -noshell -V). The SGESHELL variable defines the remote shell to invoke (default: SGESHELL := $(SGESHELL|COSHELL|SHELL|"ksh")).


Controls the creation of symbolic links during the installation of shared libraries created with the :LIBRARY: operator. By default sharedliblinks=1, which causes various links to be made to facilitate installing the shared library. When set to 0, the generation of these links are turned off and the target shared library is simply installed.


When set to 1, the default, shared libraries created with the :LIBRARY: operator contain a major.minor version number in their file name. When set to 0, shared libraries are named without version information.


When set to a non-zero value, will force the :LINK: operator to attempt a symbolic link of its lhs files to the rhs files. When set to 0 or null (the default), a hard link will be attempted.


This variable is set to $COTEMP value (see nmake(1)).


If $(viewverify) is non-null, and there are no views, then an error is issued with a severity level of $(viewverify).


nmake User’s Guide
nmake Reference Manual
nmake Web Site

nmake 16 June 2014 MAKERULES(1)