###################################
# Makefile                        #
# Adrian Perez, 2010-02-18 13:25  #
###################################

TEX := xelatex

#TEX_FLAGS = -interaction batchmode
R2B_FLAGS = --output-encoding=utf-8 \
						--use-latex-footnotes \
						--use-latex-citations \
						--use-latex-toc \
						--use-latex-docinfo \
						--use-latex-abstract \
						--table-style=booktabs \
						--graphicx-option=pdftex \
						--overlaybullets=false \
						--use-verbatim-when-possible \
						--centerfigs=true \
						--theme=Igalia

#						--theme=JuanLesPins
#						--theme=Madrid
#						--theme=Rochester
#						--theme=Pittsburgh
#						--theme=Darmstadt
#						--theme=boxes
#						--theme=Berlin
#						--theme=Luebeck
#						--theme=Malmoe
#						--theme=Frankfurt


###################################


ifeq ($(strip $(TEX)),xelatex)
  R2B_FLAGS += --font-encoding=EU1
  R2B_FLAGS += --documentoptions=xetex
else
  R2B_FLAGS += --font-encoding=T1
endif


all_rst := $(wildcard *.rst)
all_pdf := $(patsubst %.rst,%.pdf,$(all_rst))

all: $(all_pdf)

%.pdf: %.tex
	$(TEX) $(TEX_FLAGS) $<

%.tex: %.rst
	rst2beamer $(R2B_FLAGS) $< $@

.PRECIOUS: %.tex

clean:
	$(RM) *.pdf *.out *.lof *.lot *.aux *.toc
	$(RM) *.vrb *.lst *.snm *.nav *.log *.tex


.PHONY: clean

# vim:ft=make
#

