Nokia nmake Product Builder
Customer Support Newsletter

Issue No. 18 - November 2004
  1. Release lu3.7
  2. JavaDeps lu2.2
  3. Linux Platform Query
Technical Notes
  1. Quoteinclude Prefix Feature
  1. Dependency Reporting


Alcatel-Lucent nmake lu3.7 Released

We are proud to announce the general availability of nmake release lu3.7. This release provides several new features and enhancements, including:

For a more detail about the new features and the full list of changes see the lu3.7 release notes.


JavaDeps 2.2

JavaDeps release JavaDeps 2.2 is now available. JavaDeps is an optional package and only required for projects building Java code using the nmake supplied :JAVA: operator. nmake release lu3.7 requires JavaDeps 2.2 for java dependency scanning, but JavaDeps 2.2 is also backwards compatible with previous Lucent® nmake releases.

JavaDeps 2.2 features initial support for the 7 language enhancements introduced in JDK 5.0: enhanced for loop, variable-length argument list, autoboxing/unboxing, static imports, typesafe enumerations, metadata or program annotations, and generics. The language support in JavaDeps 2.2 is current as of JDK 5.0 beta 2. JavaDeps 2.2 also supports the new JDK 5.0 class naming format.

Improvements in the new JavaDeps 2.2 Java dependency analyzer tool yield substantial performance improvements. Measurements of dependency analysis times for large Java projects (in the range of 700-1000 files per project) yield speedups of 5 to 6 times times compared with JavaDeps 2.1.

For a full list of changes and to download JavaDeps see the JavaDeps page.


Linux Platform Query

We are interested to know what Linux® distributions and releases our customers are using so we can provide better support. If you are using or plan to use nmake on Linux please send a note to and let us know which distributions and releases you are using. If you plan to move to different distributions/platforms in the future let us know your future plans too. Thanks!


Technical Notes

Quoteinclude Prefix Feature

The quoteinclude feature was first introduced in release lu3.5 to allow the integration of tools that do not support -I- for referencing include files in the viewpath. This is done by identifying files that use a #include "..." directive inside the viewpath when the viewpath contains more than one node. Such files can then be changed to use #include <...> directives which do not require -I- for viewpath support. See the Issue 12: Quoteinclude article for more details on the original feature.

Release lu3.7 adds a new enhancement to the quoteinclude feature to limit the file identification to files that also inherit a directory prefix. This makes the feature useful for compilers that support -I- or similar, but do not support prefixinclude.

To enable the quoteinclude feature set the quoteinclude variable as follows:

    quoteinclude = 1|2|3 [prefix]

A value of 1 or 2 will cause nmake to issue warnings. A value of 3 will cause nmake to exit with an error. The optional prefix flag will enable the new feature and limit the warnings or errors to files that inherit a directory prefix.

The motivation for the enhancement was actually to support the -I@ option in a Wind River compiler, which is similar but not quite the same as -I-. The -I@ option changes when to search the parent file's directory for include files, where -I- says don't search the parent's directory at all. With -I@ at the end of the -I list the compiler will search the parent's directory for an include file at the end of the search if the file isn't otherwise found in the -I list. This allows the compiler to pick up many headers in the viewpath correctly, but can pose a problem when the parent file was included using a prefix directory (such as #include "dir/file1.h") and the parent includes a file in the same directory without the prefix (#include "file2.h"). In this case file2.h could be picked up from the wrong node of the viewpath if both file1.h and file2.h exist in the same node down the viewpath and only a newer file2.h exists in the top node.

For example, consider the following set of files using VPATH=dev:off.



The following compile line for the Wind River compiler will silently pick up file2.h from the off node since file1.h is there, instead of getting the newer file2.h from the dev node.

cc -I. -I/off -I@ -c file.c

Using the quoteinclude prefix feature we can identify these potential issues so they can be corrected.

First we will try the original quoteinclude feature, without the prefix option. Both file.c and file1.h are identified since they both use a #include "..." directive.

$ cat Makefile 
quoteinclude = 2
nativepp = -1
targ :: file.c

$ nmake
make: *** error file.c uses quoted include for dir/file1.h
make: *** error /off/dir/file1.h uses quoted include for file2.h
+ cc -O -I. -I/off -I@ -c file.c
+ cc -O -o targ file.o

Now using the new prefix option, only file1.h is identified since file2.h inherits the dir/ directory from it.

$ cat Makefile 
quoteinclude = 2 prefix
nativepp = -1
targ :: file.c

$ nmake
make: *** error /off/dir/file1.h uses quoted include for file2.h
+ cc -O -I. -I/off -I@ -c file.c
+ cc -O -o targ file.o

The problem can be corrected one of two ways.

  1. Change file1.h to use '#include "dir/file2.h"'
  2. Change file1.h to use '#include <file2.h>' and add '.SOURCE.h : dir' to the makefile.

The quoteinclude prefix enhancement allows the minimum set of files to be modified to use the viewpath for such a compiler. Note that the prefix option should not be used with compilers that do not support a -I@ or -I- style option.



Dependency Reporting

Dependency information can be generated from nmake using the mam translator dependency reporting tools introduced in release lu3.2. There are 4 mam translator commands, some of which are used to feed other tools to generate charts of the dependencies. The commands are:

  • mamdep - translate to simple text format
  • mamdag - translate to dag format
  • mamdot - translate to dot format
  • mamdt - translate to dt format

To use the translator commands a mam (make abstract machine) file must first be generated. Use the nmake flags -x -Mdynamic:mamfile::/. Here is an example:

$ cat Makefile 
.SOURCE.h : include inc2
abc :: a.c b.c

$ nmake -x -Mdynamic:mamfile::/
+ cc -O -Iinclude -Iinc2 -I- -c a.c
+ cc -O -I- -c b.c
+ cc -O -o abc a.o b.o

$ ls -l mamfile
-rw-r--r--    1 richb    richb        1818 Nov 10 10:32 mamfile

Now mamdep is used to get the dependency information from the mamfile. The -a flag ignores atoms matching the specified shell pattern.

$ cat mamfile | mamdep -a"*Makefile*"
1 /tools/nmake/sparc5/lu3.7/lib/probe/C/make/958E98F3obincc
1 /home/richb/n18/mam/abc
2 /home/richb/n18/mam/a.o
3 /home/richb/n18/mam/a.c
4 /home/richb/n18/mam/include/b.h
4 /home/richb/n18/mam/include/a.h
5 /home/richb/n18/mam/inc2/abc.h
3 /tools/nmake/sparc5/lu3.7/lib/probe/C/make/958E98F3obincc
3 /home/richb/n18/mam
2 /home/richb/n18/mam/b.o
3 /home/richb/n18/mam/b.c
4 /usr/include/stdio.h
5 /usr/include/sys/va_list.h
5 /usr/include/sys/feature_tests.h

The number in the left-hand column shows the level of the dependency. File abc is level 1, nothing depends on it. The level 3 file a.c depends on the level 4 files b.h and a.h. a.h also includes abc.h for a level 5 dependency. We can also see that b.c includes stdio.h which includes both va_list.h and feature_tests.h.

Here is the same example using mamdt and the dt command to create an ascii graph.

$ cat mamfile | mamdt -a"*Makefile*" | /opt/exp/bin/dt -l70

    1  all
    2   \__/tools/nmake/sparc5/lu3.7/lib/probe/C/make/958E98F3obincc
    3   |__/home/richb/n18/mam/abc
    4       \__/home/richb/n18/mam/a.o
    5       |   \__/home/richb/n18/mam/a.c
    6       |   |   \__/home/richb/n18/mam/include/b.h
    7       |   |   |__/home/richb/n18/mam/include/a.h
    8       |   |       \__/home/richb/n18/mam/inc2/abc.h
    9       |   |__/tools/nmake/sparc5/lu3.7/lib/probe/C/make/958E98F3obincc
   10       |   |__/home/richb/n18/mam
   11       |__/home/richb/n18/mam/b.o
   12           \__/home/richb/n18/mam/b.c
   13               \__/usr/include/stdio.h
   14                   \__/usr/include/sys/va_list.h
   15                   |__/usr/include/sys/feature_tests.h

Postscript or gif files can be generated using mamdot and the dot command with flags -Tps or -Tgif. Here is an example gif file.

$ cat mamfile | mamdot -a"*Makefile*" | /opt/exp/bin/dot -Tgif > mamdot.gif

click graph to enlarge

Running nmake -x -Mdynamic:mamfile::/ from the top of the build tree will create different mamfiles for each directory, named as mamfile.<subdir1>.<subdir2> etc. All the mamfiles be in the top of tree where the build was started. You can then use the following to process all the mamfiles:

$ cat mamfile* | mamdep -a"*Makefile*"

For more information and examples see Atom Dependency Reporting in the lu3.2 release notes, and the MAM Translator Commands in the Release lu3.2 Viewgraphs.


<<home / newsletters