开发者

nmake: How to redefine a macro just for an include?

I have a makefile that is to be built by [Microsoft] nmake. It references another file as an include. I do not get to modify the included file. The problem is that one of the user-defined macros used by both isn开发者_C百科't quite right for use by the include. How can I redefine this macro ONLY for where it's used in the include?

I tried something like:

`B=$(A)

A=$(C)

!include myfile.make

A=$(B)`

nmake, however did not like this. Is there another way to do this?


I just ran a test case, and the behavior I got does not agree with your description.

Suppose I have two makefiles, ...

nuit.mak:

A=17

!include nuit-a.mak

A=5

all: child main

main:
    @echo A = $(A)

And nuit-a.mak:

child:
    @echo A = $(A)

Here are the results I see:

c:\dev\make>nmake -f nuit.mak main

A = 5

c:\dev\make>nmake -f nuit.mak child

A = 17

c:\dev\make>nmake -f nuit.mak all

A = 17
A = 5
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜