2012-12-03 28 views
4

在Makefile中,我有一條規則可以通過將 腳本的輸出管道輸出到perl表達式來製作LaTeX文章中的圖表列表,該表達式將數字$ f ++遞增,並且前置圖$ f:到行。

在命令行,它工作正常,如下:

% texdepend -format=1 -print=f MilestonesProject | perl -pe 'unless (/^#/){$f++; s/^/Figure $f: /}' > FIGLIST 

產生FIGLIST:

# texdepend, v0.96 (Michael Friendly ([email protected])) 
# 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表達式中的東西被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 

有人能幫忙嗎?

-Michael

回答

相關問題