all: guide.pdf EXT = aux ilg log lof lot nlo nls out toc tns nav snm old blg bbl haux htoc TEMP=$(foreach ext,$(EXT), guide.$(ext)) PDFTEX = pdflatex -interaction nonstopmode NEED_RERUN = '(There were undefined references|Rerun (me )?to get (cross-references|the bars) right)|((Reference|Citation).*undefined)|(Label.*multiply defined)' all : ${PDF} guide_libre_asso.wiki: wget "http://wiki.april.org/index.php?title=Guide_Libre_Association_complet&action=raw" -O $@ guide_libre_asso.tex: guide_libre_asso.wiki sed -f tools/wiki2tex.sed $< > $@ sed -i $@ -e 's/.png//g' sed -i $@ -e 's/\\description/\\descriptif/g' vim -c '%s/^\(\s*\*.*\)\n\(\s*[^*]\|\n\)/\1\r\\end{itemize}\r\2/g' -c '%s/^\(\s*[^*].*\|\)\n\s*\*/\1\r\\begin{itemize}\r*/g' -c '%s/^\s*\*/\\item/' -c ':x' $@ guide.pdf: guide.tex guide_libre_asso.tex lolipop.cls ${PDFTEX} $< if egrep -q $(NEED_RERUN) $(subst tex,log,$<) ; then ${PDFTEX} $< ; fi version_html/tmp/guide.html: guide.tex guide_libre_asso.tex lolipop.hva cd version_html/tmp &&\ hevea -I ../../ $< 2> guide.log &&\ if egrep -q $(NEED_RERUN) guide.log ; then hevea -I ../../ $< 2> guide.log; fi version_html/tmp/index.html: version_html/tmp/guide.html cd $(dir $<) && hacha -nolinks $(notdir $<) version_html/tmp/index.xhtml: version_html/tmp/index.html cd $(dir $<) &&\ (tidy -c -e -utf8 -asxhtml --doctype strict --fix-uri 1 $(notdir $<) > $(notdir $@) || test -f $(notdir $@)) &&\ (for file in guide*.html; do tidy -utf8 -asxhtml --doctype strict $$file > `basename $$file html`xhtml; done || /bin/true) &&\ (tidy -utf8 -asxhtml --doctype strict index.html > index.xhtml || test -f index.xhtml) &&\ sed -i -e 's/guide\([0-9]*\)\.html/guide\1.xhtml/g' *.xhtml version_html/guide.html: version_html/tmp/index.xhtml $(wildcard version_html/tmp/*.xhtml) cd tools/xslt/ && ./xslt-html.sh clean: rm -fv $(TEMP) version_html/tmp/* mrproper: clean rm -fv guide.pdf guide_libre_asso.* version_html/guide.html distclean: mrproper