I have been using the new make utility NMAKE that comes with Microsoft
C 6.0 and in general I have been quite pleased about it. It is vastly
superior to its predecessor, MAKE.
There is a feature called Macro Substitution whereby an expression of
expands to the current definition of MACRONAME with <new-text>
substituted for every occurrence of <old-text>. My biggest complaint
is that <old-text> and <new-text> are not themselves scanned for
For example, suppose you have a group of object files that are to
be built in a certain directory. You set things up:
UTIL_DIR = c:\misc\utils
UTIL_OBJS = x.obj y.obj z.obj
I had thought that you could then do this:
$(UTIL_DIR)\$(UTIL_OBJS: = $(UTIL_DIR)\)
and it would expand into
c:\misc\utils\x.obj c:\misc\utils\y.obj c:\misc\utils\z.obj
which could then be used as the dependent files in a description
block. But no, you have to say:
c:\misc\utils\$(UTIL_OBJS: = c:\misc\utils\)
in order for it to work, since the substitution text is used "as is",
instead of being expanded. Now if I change the directory, I must
change it in two places instead of one. If Microsoft is listening,
I hope that they will consider adding this behavior.
My one other disappointment is that I had hoped that you would be able
to say to NMAKE: "Take all 'C' and 'ASM' files in the current
directory, compile them using my usual inference rules, then link them
together to form the file FOO.EXE"
I can't find a way to do this without explicitly mentioning all the
object files, e.g. :
FOO.EXE: A.OBJ B.OBJ C.OBJ
Note that this description block is all that is necessary to build
the program -- NMAKE will search for source files corresponding to
the object file targets and apply inference rules to compile them.
This itself is a big improvement over MAKE. However I would like
to go a step further and have the NMAKE program infer that if there
is an eligible source file, then it is to be compiled and the resulting
object file is to be included in the link. Does anyone know
how to automate which object files get in to the link?