O := .tmp
R2B := ./rst2beamer.py
-R2BTHEME := Darmstadt
+R2BTHEME := Frankfurt
R2BFLAGS := --halt=2 --lang es --codeblocks-use-pygments \
--input-encoding=utf-8 --output-encoding=utf-8 \
--overlaybullets= \
--theme $(R2BTHEME)
-R2BFILTER := sed '/\\usepackage\[scaled=\.90\]{helvet}/d'
+R2BFILTER := sed '/\\usepackage\[scaled=\.90\]{helvet}/d; \
+ s/\\usepackage\[utf8\]{inputenc}/\\usepackage[utf8x]{inputenc}/'
DOT := dot
DOTFLAGS :=
-AAFIG := aafigure
-AAFIGFLAGS := --proportional
-
PDFLATEX := pdflatex
PDFLATEXFLAGS := -halt-on-error -file-line-error
+PLOTS := stw pause time mem
+PROGS := bigarr conalloc concpu mcore rnddata sbtree split \
+ bh bisort em3d tsp voronoi dil
+
+STATS := ./stats.py
+TEMPLITE := ./templite.py
+
+AWK := awk
+EPSTOPDF := epstopdf
+GNUPLOT := gnuplot
+
+comma := ,
+
imgs := $O/img/mark-sweep-0.pdf \
$(patsubst %.dot,$O/%.pdf,$(wildcard img/mark-sweep-*.dot)) \
- $O/img/heap.pdf
+ $(patsubst %,$O/img/norm-hist-%.pdf,$(PLOTS))
+
+# Verbosity flag (empty show nice messages, non-empty use make messages)
+# When used internal, $V expand to @ is nice messages should be printed, this
+# way it's easy to add $V in front of commands that should be silenced when
+# displaying the nice messages.
+override V := $(if $V,,@)
+# honour make -s flag
+override V := $(if $(findstring s,$(MAKEFLAGS)),,$V)
+
+targets := presentacion.pdf notas.pdf
-presentacion.pdf: $O/presentacion.tex $(imgs)
- @echo "$(PDFLATEX) $< > $@"
- @cd $O && $(PDFLATEX) $(PDFLATEXFLAGS) $(<F) > $@.log
- @cd $O && $(PDFLATEX) $(PDFLATEXFLAGS) $(<F) >> $@.log
- @mv $O/$@ $@
+.PHONY: all
+all: $(targets)
-$O/presentacion.tex: presentacion.rst $(R2B)
- @echo "$(R2B) $< > $@"
- @$(R2B) $(R2BFLAGS) $< | $(R2BFILTER) > $@
+%.pdf: $O/%.tex
+ $(if $V,@echo "$(PDFLATEX) $< > $@")
+ $V cd $O && $(PDFLATEX) $(PDFLATEXFLAGS) $(<F) $(if $V,> $@.log)
+ $V cd $O && $(PDFLATEX) $(PDFLATEXFLAGS) $(<F) $(if $V,>> $@.log)
+ $V mv $O/$@ $@
+
+presentacion.pdf: $(imgs)
+
+$O/%.tex: %.rst $(R2B)
+ $(if $V,@echo "$(R2B) $< > $@")
+ $V $(R2B) $(R2BFLAGS) $< | $(R2BFILTER) > $@
+
+$O/notas.tex: R2BFLAGS += --shownotes=only
$O/img/%.pdf: img/%.dot
- @echo "$(DOT) $< > $@"
- @$(DOT) $(DOTFLAGS) -Tpdf -o $@ $<
- @#pdftops mark-sweep-$i.pdf && ps2pdf14 mark-sweep-$i.ps && rm mark-sweep-$i.ps
+ $(DOT) $(DOTFLAGS) -Tpdf -o $@ $<
-$O/img/%.pdf: img/%.aafig
- @echo "$(AAFIG) $< > $@"
- @$(AAFIG) $(AAFIGFLAGS) -t pdf -o $@ $<
+$O/img/norm-hist-%.csv: img/raw-hist-%.csv
+ $(if $V,@echo "norm $< > $@")
+ $V $(AWK) -F, -v m=`cut -d, -f4 $< | $(STATS) '$$1' '%(max)s'` \
+ '{print $$1 "," $$2/m "," $$3/m "," $$4/m "," $$5/m}' \
+ $< > $@
-$O/img/%.pdf: img/%.pdf
- @echo "cp $< > $@"
- @cp $< $@
+$O/img/norm-hist-%.eps: $(patsubst %,$O/img/norm-hist-\%-%.csv,$(PROGS))
+ $(if $V,@echo "plot $< > $@")
+ $V $(TEMPLITE) "progs=($(patsubst %,'%'$(comma),$(PROGS))), " \
+ "files=($(patsubst %,'%'$(comma),$^))" \
+ < histogram-plot.tpl.gpi | $(GNUPLOT) > $@
+
+$O/img/norm-hist-%.pdf: $O/img/norm-hist-%.eps
+ $(EPSTOPDF) --outfile=$@ $<
-$O/heap.pdf: AAFIGFLAGS += -s 1.4 -a 0.8
+$O/img/%.pdf: img/%.pdf
+ cp $< $@
.PHONY: clean
clean:
.PHONY: clean-all
clean-all: clean
- $(RM) presentacion.pdf
+ $(RM) $(targets)
__dummy := $(shell mkdir -p $O/img)