2016-09-20 6 views
1

ラテックスファイルからPDFを生成する際に、tex.stackexchange.comからmakefileを取得しました。ドットファイルのメイクファイル(graphviz)

# You want latexmk to *always* run, because make does not have all the info. 
# Also, include non-file targets in .PHONY so they are run regardless of any 
# file of the given name existing. 
.PHONY: paper-1.pdf all clean 

# The first rule in a Makefile is the one executed by default ("make"). It 
# should always be the "all" rule, so that "make" and "make all" are identical. 
all: paper-1.pdf 

# CUSTOM BUILD RULES 

# In case you didn't know, '[email protected]' is a variable holding the name of the target, 
# and '$<' is a variable holding the (first) dependency of a rule. 
# "raw2tex" and "dat2tex" are just placeholders for whatever custom steps 
# you might have. 

%.tex: %.raw 
    ./raw2tex $< > [email protected] 

%.tex: %.dat 
    ./dat2tex $< > [email protected] 

# MAIN LATEXMK RULE 

# -pdf tells latexmk to generate PDF directly (instead of DVI). 
# -pdflatex="" tells latexmk to call a specific backend with specific options. 
# -use-make tells latexmk to call make for generating missing files. 

# -interaction=nonstopmode keeps the pdflatex backend from stopping at a 
# missing file reference and interactively asking you for an alternative. 

paper-1.pdf: paper-1.tex 
    latexmk -bibtex -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make paper-1.tex 

clean: 
    latexmk -bibtex -CA 

私の数字は、PNGファイルに変換された.dotファイルです。私はいくつかの基本的なシェルコマンドでPNGを作ることができますが、makeの利点を失うので、シェルスクリプトを使うのは意味がありません。

ここでは、いくつかのドキュメントを読んだ後で私が試してきたことがあります。

%.png: %.dot 
    dot -Tpng $(.SOURCE) -o $(.TARGET) 

.dot.png: 
    dot -Tpng $(.SOURCE) -o $(.TARGET) 

しかし、私は直接、端末プリントをターゲットを実行しようとするたびに次のとおりです。

dot -Tpng -o 

とあったので、それはSTDINからの入力を待機するためには、保持しています入力ファイルはありません。

私はmake *.dotを実行して、ルールを起動しようとすると、私は出力を得る:

make: Nothing to be done for `figure-1a.dot'. 
make: Nothing to be done for `figure-1b.dot'. 

私は明らかに私が何をする必要があるか理解していませんよ。 PDFを作成するたびに、すべての.dotファイルを取り込み、.pngファイルを作成するにはどうすればよいですか?

UPDATE:ここで私は

graphs := $(wildcard *.dot) 
.dot.png: $(graphs) 
    dot -Tpng $(.SOURCE) -o $(.TARGET).png 

答えて

1

GNUは、$<[email protected]を使用していない.SOURCE.TARGET、レシピが

.PHONY: all 

all: $(patsubst %.dot,%.png,$(wildcard *.dot)) 

%.png: %.dot 
    dot -Tpng $< -o [email protected] 
+0

'.SOURCE'と' .TARGET'あるべき作るしようとした別の試みがあります私がオンラインで読んだものです(ソースは私を今から逃げさせますが、間違っているかどうかは関係ありません) ルールを呼び出すにはどうすればいいですか? –

+0

@ BCqrstoOが更新されました。 – user657267

+0

ありがとうございます。私はいくらか失われた以上のものでした、私はそれを感謝します! –