# Generate unicodesymbols documentation
# =====================================
# math package symbols
# --------------------
# 
# :Date:      Last revised 2011-03-24
# :Copyright: © 2011 Günter Milde <milde@users.sf.net>
# :Licence:   This work may be distributed and/or modified under the
#             conditions of the `LaTeX Project Public License`_,
#             either version 1.3 of this license or (at your option)
#             any later version.
# 
# .. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt

# Variables
# ~~~~~~~~~

# the unicode data files
DATA := ../data/unimathsymbols.txt ../data/packages.txt

# list of PDF targets generated from wildcard pattern
PDF := $(patsubst %.tex,%.pdf,$(wildcard *.tex))
# wrisym.sty fails with XeTeX
XETEX := $(filter-out wrisym-symbols.tex,$(wildcard *.tex))

# Rules
# ~~~~~

all: $(PDF)

# Generate tex files
# ''''''''''''''''''

$(XETEX): ../tools/packages_xetex.py $(DATA)
	cd ../tools; python $<

# special case: wrisym clashes with xetex
wrisym-symbols.tex: ../tools/symbols_pdftex.py  $(DATA)
	cd ../tools; python $<

# Compile tex files
# '''''''''''''''''

# two runs, because of the longtables
# TODO write a test...
%.pdf: %.tex
	xelatex $<
	xelatex $<

# special case: wrisym clashes with xetex
wrisym-symbols.pdf: wrisym-symbols.tex
	pdflatex $<
	pdflatex $<

clean:
	rm -f *.aux *.log *~

.PHONY: all clean