2012-06-05 26 views
2

我需要一个用于构建过程的nmake makefile。文件类型是TXT和PDF。因此我将推理规则添加到我的mak文件中。但是nmake完全忽略它。怎么了?为什么nmake忽略我的隐式规则?

Number=123 
Targets=A-$(Number).pdf B-$(Number).pdf 
Sources=$(Targets:pdf=txt) 

.txt.pdf: 
    copy $*.txt $*.pdf 

all: test build 

#this rule creates sample source files 
setup: 
    echo hungry > A-$(Number).txt 
    echo thursty > B-$(Number).txt 

#this rule checks the generated macros 
test: 
    @echo Sources: $(Sources) 
    @echo Targets: $(Targets) 
    dir /b $(Sources) 

build: $(Targets) 

所有我这个NMAKE Makefile中得到的是:

NMAKE : fatal error U1073: don't know how to make 'A-123.pdf' 

回答

2

我认为,“.txt.pdf:”被承认为一个隐含的规则,这两个扩展都必须在列表的后缀。尝试加入

.SUFFIXES: .txt .pdf 
+0

...并记住.SUFFIXES区分大小写。 – harper