LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 690|回复: 0

GNU Make 問題

[复制链接]
发表于 2009-12-2 15:57:30 | 显示全部楼层 |阅读模式
我在用gnuplot來畫圖。它會弄出两個檔案:%.tex和%-inc.eps、
然後跑epstopdf 來制造%-inc.pdf、
最後跑pdflatex來制造%.pdf。

為了方便,我寫了一個Makefile:
  1. figTEX=figGBL_LL_Vb0.tex figGBL_LL_Vb3.tex

  2. figPDF=$(figTEX:tex=pdf)

  3. figEPS=$(figTEX:tex=eps)
  4. figEPSi=$(figTEX:.tex=-inc.eps)

  5. # ANSI color codes
  6. RS=\\033[0m
  7. FRED=\\033[31m
  8. FGRN=\\033[32m

  9. all: $(figEPS) $(figPDF)

  10. %-inc.pdf : %-inc.eps
  11.         @echo Running $(FRED)epstopdf$(RS) to make $@ from $(FGRN)$?$(RS);
  12.         @epstopdf $<;

  13. %.pdf : %.tex %-inc.pdf
  14.         @echo Running $(FRED)pdflatex$(RS) to make $@ from $(FGRN)$?$(RS);
  15.         @pdflatex -interaction=nonstopmode $< > /dev/null;

  16. %.eps : %.tex %-inc.eps
  17.         @echo Running $(FRED)latex/dvips$(RS) to make $@ from $(FGRN)$?$(RS);
  18.         @latex -interaction=nonstopmode $< > /dev/null;
  19.         @dvips -E -o $@ $(<:tex=dvi) 2>1 > /dev/null;
  20.         rm $(<:tex=dvi);

  21. $(figTEX) $(figEPSi) : GBL_LL.gpi
  22.         @echo Running $(FRED)gnuplot$(RS) to make $@ from $(FGRN)$?$(RS);
  23.         @gnuplot $<;
复制代码


執行結果
  1. $ touch *gpi && make
  2. Running gnuplot to make figGBL_LL_Vb0.tex from GBL_LL.gpi
  3. Running latex/dvips to make figGBL_LL_Vb0.eps from figGBL_LL_Vb0.tex figGBL_LL_Vb0-inc.eps
  4. rm figGBL_LL_Vb0.dvi;
  5. Running latex/dvips to make figGBL_LL_Vb3.eps from figGBL_LL_Vb3.tex figGBL_LL_Vb3-inc.eps
  6. rm figGBL_LL_Vb3.dvi;
  7. Running epstopdf to make figGBL_LL_Vb0-inc.pdf from figGBL_LL_Vb0-inc.eps
  8. Running pdflatex to make figGBL_LL_Vb0.pdf from figGBL_LL_Vb0.tex figGBL_LL_Vb0-inc.pdf
  9. Running epstopdf to make figGBL_LL_Vb3-inc.pdf from figGBL_LL_Vb3-inc.eps
  10. Running pdflatex to make figGBL_LL_Vb3.pdf from figGBL_LL_Vb3.tex figGBL_LL_Vb3-inc.pdf
  11. rm figGBL_LL_Vb0-inc.pdf figGBL_LL_Vb3-inc.pdf
复制代码


我想問為甚麼有最後一行?我的Makefile里面没有任何rm pdf的指令。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表