Why does nmake ignore my implicit rule?

时光怂恿深爱的人放手 提交于 2019-12-24 03:22:08

问题


I need a little nmake makefile for my build process. The file types are TXT and PDF. Therefore I added a inference rule to my makfile. But nmake ignores it completely. What's wrong?

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)

All I get with this nmake Makefile is:

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

回答1:


I think that for ".txt.pdf:" to be recognized as an implicit rule, both extensions have to be in the list of suffixes. Try adding

.SUFFIXES: .txt .pdf


来源:https://stackoverflow.com/questions/10898797/why-does-nmake-ignore-my-implicit-rule

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!