Nokia Networks Home

Nokia nmake Product Builder

Quick Links

Related Products

Tutorial: A Little Help With Nokia nmake

[Table of Contents] [Previous Section] [Next Section]

4. Comments

Makefile comments begin with /*, end with */, and don't nest. The C-style comments go anywhere, even in action blocks that are shell scripts. You should want proof, because * means something special to the shell, so it's not hard to imagine problems. If you're not sure what we're talking about, see what the shell does when you type:

     echo /* disappears */ "hello, /* shouldn't disappear */ world"

The opening /* matches everything in the root directory on your system, and the closing */ matches some of your own directories. We could have done some damage if echo had actually been rm -r. Now let's try the same command, but in a makefile. Put

     hello :
        silent echo /* disappears */ "hello, /* shouldn't disappear */ world"

in comment.mk and type

     nmake -f comment.mk

and we get:

     hello, /* shouldn't disappear */ world

The comment that was supposed to disappear really did, and the stuff that looked like a comment didn't fool nmake because it noticed the quoted string. Obviously, handling C-style comments in action blocks isn't trivial. They need to be removed, but finding comments means nmake has to look through action blocks the way the shell would, because throwing too much away is no good either.

4.1 Some Comments About Comments

Single line shell-style comments introduced by # are also allowed, but sometimes what happens can be surprising: use # too early in a makefile and nmake may decide to run /bin/make; follow the # by words, like include or define, that mean something to cpp, and nmake may decide to preprocess your makefile [14] If you don't like surprises stick to the C-style comments.

Makefiles are programs and they often deserve some documentation. Comments are convenient and inexpensive, so don't leave them out just because you're concerned about efficiency. In fact, most of the time nmake won't even notice comments, because it usually reads objectfiles.

FOOTNOTES:

[14]
Preprocessing makefiles is not recommended and may not be supported in future releases.

[Table of Contents] [Previous Section] [Next Section]

Last Update: Friday,12-Aug-2016 12:19:20 EDT