为什么NMAKE忽略我的隐含规则?(Why does nmake ignore my implici

2019-09-17 18:43发布

我需要为我的构建过程有点NMAKE生成文件。 该文件类型TXT和PDF。 因此,我增加了一个推理规则我makfile。 但是,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'

Answer 1:

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

.SUFFIXES: .txt .pdf


文章来源: Why does nmake ignore my implicit rule?
标签: nmake