【发布时间】:2012-12-03 20:30:47
【问题描述】:
在 Makefile 中,我有一条规则,可以通过管道从 LaTeX 论文中创建图形列表 从脚本输出到 perl 表达式,该表达式递增数字 $f++ 并将数字 $f: 添加到行中。
从命令行,它工作正常,如下:
% 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 解释,我不知道如何引用它或其他方式 让它不可见。
我最近在 Makefile 中的尝试:
## Generate FIGLIST; doesnt work due to Make quoting
FIGLIST:
$(TEXDEPEND) -format=1 -print=f $(MAIN) | perl -pe 'unless (/^#/){\$f++; s/^/Figure \$f: /}' > FIGLIST
有人可以帮忙吗?
-迈克尔
【问题讨论】: