Nokia Networks Home

Nokia nmake Product Builder

Quick Links

Related Products

[ Eclipse Support Documents ]

Using Nokia nmake with Eclipse CDT


This page provides information on using Nokia nmake with the Eclipse CDT, an Eclipse-based IDE for C and C++ development. These procedures were developed using Eclipse 3.3, CDT 4.0, and nmake alu3.9 on Linux, and have been verified on Solaris. Procedures developed using previous versions of Eclipse, CDT, and nmake are available in a separate document.

To simplify the discussion, we describe project setup in the context of a simple but representative example.

Example project

Following is a typical nmake based project structure:


Although simple, this project exhibits many aspects of larger projects--multiple source directories, Makefiles at different levels of the tree, and separate library source directories. ex1 is the project root (in nmake terminology, the viewpath node root) containing the src, bin, and lib directories. src is the root of the source tree and is the top level build directory. Following are contents of selected Makefiles.


recurse_begin_message = gnu


include $(VROOT)/src/

:MAKE: lib - cmd


include $(VROOT)/src/

:MAKE: *


include $(VROOT)/src/

cmd1 :: a.c b.c c.c -llb1

Complete source for this project is available in tar archive ex1.tar.gz. The top level archive directory is ex1.

ex1/src/ is a project global Makefile that is included by all other project Makefiles. It contains project settings that are visible to all project Makefiles. Setting recurse_begin_message = gnu configures nmake to output GNU make style recursion messages. This allows the default Eclipse CDT error parser to track the current directory in recursive builds. (The recurse_begin_message = gnu feature was introduced in nmake alu3.9.) The Makefiles containing the :MAKE: assertion tell nmake to recurse to the directories specified on the right hand side. The remaining Makefiles are leaf Makefiles and specify builds for executable and library targets.

To build this project standalone (outside of Eclipse), unpack the tar archive into a project working area, for example <PROJECT>/ex1. nmake should be on the PATH, and VPATH set in the environment. Since this project has only a single node, set VPATH to the absolute path leading to the viewpath node root directory ex1, for example <PROJECT>/ex1. A C compiler cc should be on the path, alternatively point environment variable CC to your C compiler (for example, CC=/usr/bin/gcc).

Run the following commands from the top level build directory src. Type nmake install to build and install the entire project. Each library and executable is built locally and then installed in the project install directories lib and bin. Type nmake recurse clobber to remove generated targets each local development directory. Type nmake recurse clobber.install to remove all installed products.

Eclipse project setup

Set up the environment as described above before starting Eclipse. In addition, the directory ex1/toolbin should be on the PATH. Start Eclipse from the project top level build directory <PROJECT>/ex1/src. When starting Eclipse, you need to specify the Eclipse workspace (by default $HOME/workspace). For this example, the Eclipse workspace directory should be separate and distinct from the project root directory <PROJECT> discussed in the last section. By default, project resources appear directly within the Eclipse workspace. However, when creating the CDT project for this example, we will use an Eclipse feature that allows creation of a C/C++ project from an existing project source root located at an arbitrary location in the file system. This approach provides flexibility that is useful in many development scenarios.

Create a new CDT project using File > New > Project, select C Project and press Next. Set Project name: to ex1. Uncheck Use default location and set the Location: field to the existing project source path <PROJECT>/ex1. Select Makefile project under Project types and select your toolchain under Toolchain. On Linux, you might select Linux GCC. Select Finish. Answer Yes if the project setup wizard offers to open the C/C++ perspective. A new project name ex1 should now appear in the Project Explorer containing a top level src directory containing the example project Makefile and other sources.

Eclipse project configuration

Right click on the the project in the Project Explorer and bring up the project properties dialog. On the C/C++ Build page Builder settings tab, unselect Use default build command and enter ksh nmk in the Build Command: text field. Check that Generate Makefiles automatically is unchecked. Change Build directory to ${workspace_loc:/ex1/src}. On the Behavior tab, verify that Build on resource save (Auto build) is unchecked. Change the make target for Build (Incremental build) from all to install. Change the make target for Clean from clean to recurse clobber.

The following figure shows the configured C/C++ Build Builder Settings properties for project ex1:

project ex1 properties -- build settings

Properties for project ex1 -- build settings.

The following figure shows the configured C/C++ Build Build Behavior properties for project ex1:

project ex1 properties -- build behavior

Properties for project ex1 -- build behavior.

Turn off automatic building using Project > Build Automatically.

Eclipse project builds

Build the project using Project > Build Project. This launches a global project build using nmake install. The build log appears in the Console view. Sample build output appears below. This output was generated using the debug build configuration (see section Build configurations for more information about build configurations):

sample project build output

Sample project build output.

Any errors in C source files (including C source files in nested directories) create problem markers in the Problems view that correctly map back to the source file location containing the error.

You can clean up by doing Project > Clean..., which runs the command nmake clobber install. Uncheck Start a build immediately unless you want to rebuild after clobbering.

Make targets

In addition to the project level Build all and Clean build types, CDT allows you to define custom make targets that may appear at any level of the build hierarchy. This allows you to easily perform build operations at any level, from building an entire project down to building a single executable or library in a source directory. You may also find it handy to set up make targets for nmake common actions such as clobber.

Use the Make Targets view to set up and run arbitrary make targets. The Make Targets may appear in C/C++ perspective by default, otherwise display it using Window > Show View. Let's define a make target that runs nmake recurse clobber.install from the top level build directory. Display the src directory in the Make Targets view. Right click on src and select Add Make Target. Enter clobber.install in the Target Name field, and enter recurse clobber.install in the Make Target field. Set Build command to ksh nmk. (nmk is a helper script for launching make targets located in the project toolbin.) Press Create to create the new make target. A new target should appear in the Make Targets view in the top-level src directory. Run the target by double clicking on the target icon or right-click on the target and select Build Make Target.

As another example, we can create make targets to run nmake targets in directory cmd1. Right click directory cmd1 and select Add Make Target to bring up the Create a new Make target dialog. Enter all for Target Name and Make Target, and set Build command set to ksh nmk. Select Create to create the target. Follow the same procedure to create a clobber target; the only difference is the contents of the Make Target field which you should set to clobber. You can use the same procedure to set up make targets in directory cmd2.

The following figure shows the configured Make Targets view. There is a project level clobber install target (selected) as well as all and clobber targets in leaf level directories cmd1 and cmd2. You can run any of these targets directly from this view:

Make targets at multiple levels.

Make targets view showing targets at multiple levels.

You can modify a make target specification at any time through the target context menu. The make target specification dialog for the clobber install target looks like:

make target specification dialog.

Make target specification dialog for the clobber install target.

Build configurations

Eclipse "Build Configurations" allow you to define variant build configurations and easily switch among configurations. In this example we show how to define a "debug" configuration that generates debug versions of executables and libraries. Then, setting the debug configuration as the "active" configuration causes all project builds, including "make target" builds, to generate debug versions of build targets. Switching the active configuration back to the original configuration restores the default behavior.

With project ex1 selected in the Project Explorer, select Project > Build Configurations > Manage. A Manage configurations dialog window pops up. Select New... to obtain a MBS:create configuration dialog. Enter Debug in the Name: field, and nmake debug configuration in the Description field. Allow the new configuration to copy settings from the current working configuration. Click OK. Back in the Manage configuration dialog window, click Set Active to make the new configuration the active configuration. Click OK to exit the dialog window.

To specify the variant settings for the new build configuration, go to Project > Properties. Select property category C/C++ Build > Environment. Select the new Debug configuration using the Configuration selection box at the top of the dialog. Enter a new variable with Name CCFLAGS and Value -g. Make sure that Add to all configurations is not checked. Select OK to exit the properties dialog.

setting for variant build configuration

Specifying variant environment setting for the debug build configuration.

You can now easily switch the active build configuration using the Projects > Build Configurations > Set Active (or use the corresponding toolbar selector). When the Debug configuration is active, the project build as well as all defined make targets build debug versions of their targets. You can define any number of build configurations and specify modified build options and variables within each configuration.

build configuration management dialog

Build configuration management dialog.


  • toolbin/nmk is a helper script for launching make targets. It works around issues encountered when specifying nmake directly in the make target dialog when defining make targets that are not in the top level build directory. nmk also provides a handy place to implement Eclipse-specific build behavior, such as printing a message to the build console confirming build completion, or filtering out repetitive compiler warnings.
  • The Eclipse Makefile editor does not recognize nmake comments or user defined assertion statements, leading to error markers in the Makefile outline view. These markers are harmless. We plan to investigate this issue further.
  • After initial creation, <PROJECT>/ex1 may be easily imported from the file system into other instances of Eclipse (for example, on another machine). Key Eclipse project settings are retained under <PROJECT>/ex1. Select File > Import > General > Existing Projects into Workspace and click Next. In dialog Import choose Select root directory and <PROJECT>/ex1 in the associated text box. Do not check Copy projects into workspace. Select Finish. The project is then created and an initial build is performed. You may need to bring up the C/C++ perspective after import. Since the import launches a build, it is best to set up the environment for a build before performing the import (nmake and nmk on your path, etc.). Key project build configuration settings, including make targets and build configurations, are automatically carried over into the imported project. You may need to set workbench global options such as disabling Project > Build Automatically. (Note that importation of project contents from a source code management system rather than the file system is a generally preferred method for sharing project source between Eclipse instances.)
Last Update: Friday,12-Aug-2016 10:54:49 EDT