如何在makefile中引用perl$符号

如何在makefile中引用perl$符号,perl,makefile,quoting,Perl,Makefile,Quoting,在Makefile中,我有一个规则,通过管道将 从脚本到perl表达式的输出,该表达式将数字$f++递增,并将数字$f:前置到行 在命令行中,它可以正常工作,如下所示: % texdepend -format=1 -print=f MilestonesProject | perl -pe 'unless (/^#/){$f++; s/^/Figure $f: /}' > FIGLIST 生成菲格利特: # texdepend, v0.96 (Michael Friendly (frien

在Makefile中,我有一个规则,通过管道将 从脚本到perl表达式的输出,该表达式将数字$f++递增,并将数字$f:前置到行

在命令行中,它可以正常工作,如下所示:

% texdepend -format=1 -print=f MilestonesProject | perl -pe 'unless (/^#/){$f++; s/^/Figure $f: /}' > 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
有人能帮忙吗


-迈克尔

美元符号翻倍

## Generate FIGLIST
FIGLIST:
    $(TEXDEPEND) -format=1 -print=f $(MAIN) \
    | perl -pe 'unless (/^\#/){$$f++; s/^/Figure $$f: /}' > $@
您可能还需要对注释符号进行反斜杠转义。我这样做只是以防万一

另见