]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/help/C/Makefile
generate deps on the fly
[helm.git] / helm / software / matita / help / C / Makefile
index dccc62ed6f74cee2f9a6d7369bf78b074fdd6b3c..329473d06e0d0da4896eb07dc080b326db490f44 100644 (file)
@@ -1,15 +1,39 @@
+
+include ../../../Makefile.defs
+
 XSLTPROC=xsltproc
 XHTML_XSL=matita-xhtml.xsl
 FO_XSL=matita-fo.xsl
+TEX_XSL=matita-tex.xsl
+TEX_UNICODE_PATH=$(SRCROOT)/share/texmf/unicode
+TEX_ENV=TEXINPUTS=.:$(TEX_UNICODE_PATH):$(TEX_UNICODE_PATH)/data:
 MAIN=matita.xml
+DEPS := $(wildcard *.xml)
+
+# one of: "fop", "pdflatex"
+PDF_METHOD=pdflatex
+
+# one of: "docbook2tex", "xsl"
+TEX_METHOD=xsl
 
 all: html txt
 
+clean:
+       rm -f *.html *.fo *.pdf
+       rm -rf $(filter-out version.txt,$(wildcard *.txt))
+       rm -f *-stamp
+       rm -f matita.out matita.log matita.glo matita.dvi matita.idx
+       rm -f matita.aux matita.tex
+
+# test (dumb implementation)
+test:
+       SP_ENCODING=UTF-8 docbook2txt matita.xml
+
 # XHTMLs generation
 
 .PHONY: html
 html: html-stamp
-html-stamp: $(MAIN)
+html-stamp: $(MAIN) $(DEPS) $(XHTML_XSL)
        xsltproc $(XHTML_XSL) $<
        touch $@
 
@@ -29,12 +53,30 @@ txt-stamp: html-stamp
 pdf: pdf-stamp
 pdf-stamp: $(patsubst %.xml,%.pdf,$(MAIN))
        touch $@
+
 %.fo: %.xml
        xsltproc $(FO_XSL) $< | xmllint --format - > $@
+ifeq ($(TEX_METHOD),docbook2tex)
+%.tex: %.xml
+       docbook2tex $<
+else ifeq ($(TEX_METHOD),xsl)
+%.tex: %.xml $(TEX_XSL)
+       xsltproc $(TEX_XSL) $< > $@
+endif
+
+ifeq ($(PDF_METHOD),fop)
 %.pdf: %.fo
        fop $< $@
-clean:
-       rm -f *.html *.fo *.pdf
-       rm -rf $(filter-out version.txt,$(wildcard *.txt))
-       rm -f *-stamp
+else ifeq ($(PDF_METHOD),pdflatex)
+%.pdf: %.tex
+       $(TEX_ENV) pdflatex $<
+endif
+
+%.dvi: %.tex
+       $(TEX_ENV) latex $<
+%.ps: %.dvi
+       dvips $<
+
+.PRECIOUS: matita.tex
+