Re:Ask HN: In what creative ways are you using Makefiles?
by graphene on Monday July 24, 2017 @04:59AM
(#14836873)
I do something similar, here's my Makefile -- I have scripts that build figures in a separate directory, /figures. I'm sure it could be terser, but it does the job for me.
[ Parent
| on HN ]
Re:Ask HN: In what creative ways are you using Makefiles?
by xelxebar on Monday July 24, 2017 @08:10AM
(#14837746)
I noticed that you have some file dependencies not encoded in the targets. Also, you might like reading up on Automatic Variables ($@, $^, $<, etc). Anyway, just for fun I tried rewriting your script in a way that should Just Work a little better.
texfiles = $(wildcard *.tex)
figures_ink = figures/junction_occupations.pdf
figures_py = figures/overlaps_barplot.pdf \
figures/transmission_comparison.pdf \
figures/wigner_distributions.pdf
figures = $(figures_ink) $(figures_py)
main.pdf: main.tex $(texfiles) $(figures)
pdflatex $<
bibtex $(<:*.tex=*)
pdflatex $<
pdflatex $<
figures/junction_occupations: %: %.hs
ghc --make $^
figures/junction_occupations.svg: figures/junction_occupations
$< -w 800 -h 400 -o $@
$(figures_ink): %.pdf: %.svg
inkscape -D -A $@ $^
$(figures_py): %.pdf: %.py
python $^
clean:
rm *.log *.aux *.blg *.bbl *.dvi main.pdf
Re:Ask HN: In what creative ways are you using Makefiles?
by kurlberg on Monday July 24, 2017 @12:11PM
(#14839677)
Check out latexmk: it keeps track of having to run bibtex etc, and runs latex "enough times" so that all equation refs etc have stabilised. (Latexmk -pdf to build a pdf, default is dvi.)