We are pleased to announce availability of Alcatel-Lucent nmake 15. This release provides several features and enhancements, including the following:
- Eclipse Sub-directory Builds
Integration with Eclipse has been enhanced to support sub-directory builds launched through Eclipse CDT custom make targets.
- New Special Atom to Identify Directories
The .DIRECTORY Special Atom has been added to mark atoms bound to directories, analogous to the .REGULAR Special Atom for marking regular files.
- New Edit Operator Options to Identify Existing Files, Directories or Links
The :P=X edit operator (unbound existing files) has been extended to optionally list only regular files, directories, symbolic links or any combination of the three. (See issue 043.)
- New Edit Operator options to Quote nmake Metacharacters
The :Q edit operator (shell quote) has been extended to allow quoting for regular expression and shell pattern metacharacters used by nmake.
- New inode Rule Trigger
The new .TRIGGER.inode Special Atom can be used to add an inode comparison to a rule and is now used by the :LINK: assertion.
- Enhanced Pipe Support for read Statement
The new -l option to the nmake read statement will read one line at a time, useful for reading from pipes.
- Updates for :LIBRARY:, :MAKE:, clobber, probe, build logs, man pages and more.
With few exceptions, nmake 15 is upwardly compatible from nmake 14. See the nmake 15 Release Notes for more information including a complete list of changes from the nmake 14 release. Current customers may upgrade free of charge to nmake 15 using existing installed licenses, no license upgrade is required. See the nmake 15 release page for download information and documentation.
Some of you may have already noticed the nmake web site has a new, easy-to-remember address at http://nmake.alcatel-lucent.com/. The old bell-labs.com site will silently forward nmake web requests to the corresponding page on the new site, but please update any bookmarks and links you have as we don't know how long forwarding will last. The new site contains the same content as the old site, let us know if you experience any trouble.
An approach to Viewpathing in Eclipse CDT was recently documented and added to the FAQ section of the web site. The document describes an approach to setting up viewpathed projects in Eclipse CDT. nmake projects are commonly structured in multiple build nodes using viewpathing; nmake automatically generates appropriate compilation flags to ensure source and header files are resolved according to the rules for viewpathing. However, without correct setup, the Eclipse CDT indexer will not follow the same rules, leading to incorrect header file resolution. This FAQ describes how to configure Eclipse CDT so that the CDT indexer picks up the correct files.
An example build log report script written in Perl has been added to the Tool Repository. The script may be downloaded from the tgreport.pl page and modified to provide custom reports. The script demonstrates several build log processing techniques in Perl, including how to access single data items such as vpath, filter targets that run nmake recursively, find data elements using relative paths, access job output, find multiple stacked parent makefiles, parse target start/end times and calculate job durations, and test for failed targets. Example output is shown below after running xmakelog to generate the XML build log.
$ perl tgreport.pl makelog.xml vpath /home/richb/projects/nightly/linux /home/richb/projects/nightly/source builddir /home/richb/projects/nightly/linux/src target-name almond1.o exit-code 0 start-time 12:56:32.822873 end-time 12:56:33.126217 duration 0.303344 pwd /home/richb/projects/nightly/linux/src/lib/libtr1 target-name apple1.o exit-code 0 start-time 12:56:33.311279 end-time 12:56:33.894835 duration 0.583556 pwd /home/richb/projects/nightly/linux/src/lib/libtr1 ... number of leaf targets found: 458 number of targets with non-zero exit code: 3
The release of nmake 15 adds the -l option to the nmake read command to read input one line at a time. This restores the behavior of the read command prior to release lu3.2 when it was changed to read an entire file. Reading a line at a time can be useful for reading and processing input from another command.
The following example reads the output from ls -l $(MAKELIB), where MAKELIB is the lib/make/ directory of the nmake installation. Each line is read into variable VAR and then printed in place of more elaborate processing.
$ cat Makefile .OPEN : .FUNCTION read -nu6p "$(%) ; echo .EOF." return 6 .READLN : .FUNCTION local fd var fd = $(%:O=1) var = $(%:O=2) eval read -lu$(fd) $(var) end if "$($(var))" == ".EOF." return 0 end return 1 targ1 : .MAKE FD := $(.OPEN ls -l $(MAKELIB)) while $(.READLN $(FD) VAR) print VAR = "$(VAR)" end $ nmake VAR = "total 544" VAR = "-r--r--r-- 1 nmake sablime 9230 May 28 11:34 JAR.mk" VAR = "-r--r--r-- 1 nmake sablime 22324 May 28 11:34 JAVA.mk" VAR = "-rw-r--r-- 1 nmake sablime 330 May 28 11:34 Makeinstall.mk" VAR = "-r--r--r-- 1 nmake sablime 83120 May 28 11:34 Makerules.mk" VAR = "-r--r--r-- 1 nmake sablime 651 May 28 11:34 PROBE.mk" VAR = "-r--r--r-- 1 nmake sablime 1173 May 28 11:34 S.mk" VAR = "-r--r--r-- 1 nmake sablime 1231 May 28 11:34 SERVICE.mk" VAR = "-r--r--r-- 1 nmake sablime 6078 May 28 11:34 SYSTEM.mk" VAR = "-r--r--r-- 1 nmake sablime 7007 May 28 11:34 Scanrules.mk" VAR = "-r--r--r-- 1 nmake sablime 4685 May 28 11:34 TABLE.mk" VAR = "-r--r--r-- 1 nmake sablime 1103 May 28 11:34 WIN32.mk" VAR = "-r--r--r-- 1 nmake sablime 672 May 28 11:34 debug.mk" VAR = "-rw-r--r-- 1 nmake sablime 715 May 28 11:34 explain.map" VAR = "-rw-r--r-- 1 nmake sablime 83468 May 28 11:34 makerules.mo" VAR = "-r--r--r-- 1 nmake sablime 1965 May 28 11:34 nt.mk" VAR = "-r--r--r-- 1 nmake sablime 58 May 28 11:34 version" VAR = "-r--r--r-- 1 nmake sablime 855 May 28 11:34 yacc.mk"
In the Makefile, targ1 is the default target. It is a .MAKE target so its action is executed by nmake and not sent to the shell; the action is composed of nmake commands. Let's go through each line of the action block.
FD := $(.OPEN ls -l $(MAKELIB))
Here the .OPEN function is called with the command we want to execute. Our .OPEN function uses the nmake read command to launch the specified shell command. Note when the shell command finishes it does an echo .EOF. which will be used later to detect when the output is complete. The read command is run with the -nu6p flags. The -n flag suppresses reading input when no variable is specified. This allows us to launch the command and start reading input later. The -u6 flag specifies to use file descriptor 6 for reading the output of this command. The -p flag reads input from the specified process where -i would be used to specify a file. The .OPEN function returns 6 to tell the calling rule what file descriptor to read, which is placed in the FD variable above.
while $(.READLN $(FD) VAR)
The next line starts a while loop calling the .READLN function. The file descriptor to read and the variable to store the line are passed to the function. The .READLN function uses read -lu$(fd) to read the input. The -l flag indicates to read only one line. The -u$(fd) flag specifies the file descriptor that we passed to the function. When read hits .EOF. the function returns 0 which stops the while loop, otherwise it returns 1 to keep looping.
print VAR = "$(VAR)"
Inside the loop we just print the current line. Of course more significant processing of the input can be done here.
Finally we end the loop.
This is just one example of using read -l to simulate a typical read loop for processing input. Other possibilities exist. We hope you find the feature useful.
We are interested in any feedback you might have about nmake. Please send comments / suggestions to email@example.com.
We're also open to suggestions for future articles. If there is anything you would like to see in the newsletter please send us a note to firstname.lastname@example.org. Thanks for your support!