|
我在用gnuplot來畫圖。它會弄出两個檔案:%.tex和%-inc.eps、
然後跑epstopdf 來制造%-inc.pdf、
最後跑pdflatex來制造%.pdf。
為了方便,我寫了一個Makefile:
- figTEX=figGBL_LL_Vb0.tex figGBL_LL_Vb3.tex
- figPDF=$(figTEX:tex=pdf)
- figEPS=$(figTEX:tex=eps)
- figEPSi=$(figTEX:.tex=-inc.eps)
- # ANSI color codes
- RS=\\033[0m
- FRED=\\033[31m
- FGRN=\\033[32m
- all: $(figEPS) $(figPDF)
- %-inc.pdf : %-inc.eps
- @echo Running $(FRED)epstopdf$(RS) to make $@ from $(FGRN)$?$(RS);
- @epstopdf $<;
- %.pdf : %.tex %-inc.pdf
- @echo Running $(FRED)pdflatex$(RS) to make $@ from $(FGRN)$?$(RS);
- @pdflatex -interaction=nonstopmode $< > /dev/null;
- %.eps : %.tex %-inc.eps
- @echo Running $(FRED)latex/dvips$(RS) to make $@ from $(FGRN)$?$(RS);
- @latex -interaction=nonstopmode $< > /dev/null;
- @dvips -E -o $@ $(<:tex=dvi) 2>1 > /dev/null;
- rm $(<:tex=dvi);
- $(figTEX) $(figEPSi) : GBL_LL.gpi
- @echo Running $(FRED)gnuplot$(RS) to make $@ from $(FGRN)$?$(RS);
- @gnuplot $<;
复制代码
執行結果
- $ touch *gpi && make
- Running gnuplot to make figGBL_LL_Vb0.tex from GBL_LL.gpi
- Running latex/dvips to make figGBL_LL_Vb0.eps from figGBL_LL_Vb0.tex figGBL_LL_Vb0-inc.eps
- rm figGBL_LL_Vb0.dvi;
- Running latex/dvips to make figGBL_LL_Vb3.eps from figGBL_LL_Vb3.tex figGBL_LL_Vb3-inc.eps
- rm figGBL_LL_Vb3.dvi;
- Running epstopdf to make figGBL_LL_Vb0-inc.pdf from figGBL_LL_Vb0-inc.eps
- Running pdflatex to make figGBL_LL_Vb0.pdf from figGBL_LL_Vb0.tex figGBL_LL_Vb0-inc.pdf
- Running epstopdf to make figGBL_LL_Vb3-inc.pdf from figGBL_LL_Vb3-inc.eps
- Running pdflatex to make figGBL_LL_Vb3.pdf from figGBL_LL_Vb3.tex figGBL_LL_Vb3-inc.pdf
- rm figGBL_LL_Vb0-inc.pdf figGBL_LL_Vb3-inc.pdf
复制代码
我想問為甚麼有最後一行?我的Makefile里面没有任何rm pdf的指令。 |
|