nmake.exe: is there a way to exclude a file from a set of files specified in a macro?

Posted by Cheeso on Stack Overflow See other posts from Stack Overflow or by Cheeso
Published on 2010-05-10T20:42:56Z Indexed on 2010/05/10 20:54 UTC
Read the original article Hit count: 413

Filed under:
|

I'm looking for something like the Exclude filter for msbuild, but I Want it in a makefile processed by nmake.

Is that possible?

Suppose I have a makefile that defines this macro:

SOURCES=xxx.c  yyy.c  zzz.c

and I invoke it with nmake OLD=xxx.c NEW=bbb.c

...can I produce, within the makefile, a macro with a value like:

yyy.c zzz.c  bbb.c 

...basically substituting bbb.c for xxx.c ?

The files can appear in any order.


This would be pretty easy if the string substitution that is possible in nmake macros, allowed for evaluation of macros.

In other words, I can do

sources=xxx.c yyy.c zzz.c
objs=$(sources:.c=.o)

and the value of $(objs) is

xxx.o yyy.o zzz.o

But nmake does not allow a macro for the value of either argument to that substitution. I cannot do this:

new=.o
sources=xxx.c yyy.c zzz.c
objs=$(sources:.c=$(new))

© Stack Overflow or respective owner

Related posts about nmake

Related posts about Windows