在一个Makefile中,我有一个规则,通过将脚本的输出导入到一个perl表达式中,对图像列表进行编号$f++并在行前添加Figure $f:。从命令行中运行时,它可以正常工作,如下所示:
生成 FIGLIST:
% texdepend -format=1 -print=f MilestonesProject | perl -pe 'unless (/^#/){$f++; s/^/Figure $f: /}' > FIGLIST
生成 FIGLIST:
# texdepend, v0.96 (Michael Friendly (friendly@yorku.ca))
# commandline: texdepend -format=1 -print=f MilestonesProject
# FIGS =
Figure 1: fig/langren-google-overlay2.pdf
Figure 2: fig/mileyears4.png
Figure 3: fig/datavis-schema-3.pdf
Figure 4: fig/datavis-timeline2.png
...
我不知道如何在Makefile中使这个工作正常,因为perl表达式中的$f会被make解释,我无法想出如何引用它或使其对make不可见。
我在最近的Makefile尝试中:
## Generate FIGLIST; doesnt work due to Make quoting
FIGLIST:
$(TEXDEPEND) -format=1 -print=f $(MAIN) | perl -pe 'unless (/^#/){\$f++; s/^/Figure \$f: /}' > FIGLIST
有人能帮忙吗?
- 迈克尔