Merge from trunk
[plcapi.git] / trunk / doc / Makefile
diff --git a/trunk/doc/Makefile b/trunk/doc/Makefile
new file mode 100644 (file)
index 0000000..3adaa1f
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# (Re)builds API documentation
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2006 The Trustees of Princeton University
+#
+# $Id$
+#
+
+all: PLCAPI.pdf
+
+.PLCAPI.xml.valid: Methods.xml
+
+Methods.xml: DocBook.py ../PLC/__init__.py ../PLC/Methods/__init__.py
+       PYTHONPATH=.. python $< > $@
+
+#
+# Documentation
+#
+
+# Validate the XML
+.%.xml.valid: %.xml
+       xmllint --valid --output $@ $<
+
+# Remove the temporary output file after compilation
+.SECONDARY: .%.xml.valid
+
+# Compile it into other formats
+FORMATS := dvi html man ps pdf rtf tex texi txt
+
+DOCBOOK2FLAGS := -V biblio-number=1
+
+define docbook2
+%.$(1): %.xml .%.xml.valid
+       docbook2$(1) --nochunks $$(DOCBOOK2FLAGS) $$<
+endef
+
+$(foreach format,$(FORMATS),$(eval $(call docbook2,$(format))))
+
+clean:
+       rm -f $(patsubst %,*.%,$(FORMATS)) .*.xml.valid Methods.xml
+
+force:
+
+.PHONY: force clean docclean