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