How to quote perl $ symbol in makefile

In the Makefile, I have a rule to make a list of figures from LaTeX paper, output from a script to a perl expression, which increments the digits of the numbers $ f ++ and prepends Figure $ f: to the lines.

On the command line, it works fine:

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

creating 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 ... 

I cannot figure out how to make this work in the Makefile because the $ f element in the perl expression is interpreted by make, and I cannot figure out how to quote it or otherwise make it invisible.

My last attempt at the Makefile:

 ## Generate FIGLIST; doesnt work due to Make quoting FIGLIST: $(TEXDEPEND) -format=1 -print=f $(MAIN) | perl -pe 'unless (/^#/){\$f++; s/^/Figure \$f: /}' > FIGLIST 

Can anyone help?

-Michael

+4
source share
1 answer

Double dollar sign.

 ## Generate FIGLIST FIGLIST: $(TEXDEPEND) -format=1 -print=f $(MAIN) \ | perl -pe 'unless (/^\#/){$$f++; s/^/Figure $$f: /}' > $@ 

You may need a backslash - also avoid the comment character. I did it just in case.

See also http://www.gnu.org/software/make/manual/html_node/Variables-in-Recipes.html#Variables-in-Recipes

+4
source

All Articles