make:ifneq中的错误:单词意外(期望")")



我想为 LaTeX 文档创建一个制作文件(在这个最小的示例)。当没有文件"makeindexstyle.ist"时,应该创建它(由运行make makeindexstyle.ist)并用于格式化索引。规则 %.pdf反映了这一点。但是,它还没有工作,我收到错误

ifneq (, ) {
/bin/sh: 1: Syntax error: word unexpected (expecting ")")
make: *** [master.pdf] Error 2

怎么了?

Parts from Makefile:
MASTER = master
TEX = slave
TEXI = texi2dvi -p
all: $(MASTER:=.pdf)
%.pdf: %.tex $(TEX:=.tex)
    ifneq ($(wildcard makeindexstyle.ist), ) { # if makeindexstyle.ist exists, compile and build index
        $(TEXI) $<
        make makeindexstyle.ist
        makeindex -c -s makeindexstyle.ist $(MASTER:=.idx)
    }
    endif
    $(TEXI) $<
makeindexstyle.ist:
    @(echo "...") > makeindexstyle.ist

更新:我试图使其尽可能简单,以查看错误的来源。除其他事项(例如引用)外,我尝试了以下方法:

%.pdf: %.tex $(TEX:=.tex)
    exist := $(wildcard "absolute-path-to-makeindexstyle.ist")
    ifneq ($strip $(exist)),)
             echo "foo"
    endif
    $(TEXI) $<

但结果是

exists := 
make: exists: Command not found
make: *** [book.pdf] Error 127

同时,我可以在外壳方面解决它:

IDX = "makeindexstyle.ist"
%.pdf: %.tex $(TEX:=.tex)
    @if test -f $(IDX); then 
        echo "foo"; 
    fi
    $(TEXI) $<

这听起来像是 如何检查文件是否存在于Makefile?或 如何通过测试文件是否存在来有条件地设置Makefile变量。

尝试

ifneq ($(wildcard makeindexstyle.ist),)

没有空间。或者,围绕论点抛出""

相关内容

最新更新