Make room for arch specific download directory.
[myplc.git] / doc / Makefile
index 6a9823e..feb5a7c 100644 (file)
@@ -4,32 +4,41 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Makefile 704 2007-07-20 14:15:43Z thierry $
+# $Id$
 #
 
-vpath GenDoc.xsl ../../plc_www/doc
-vpath %_config.xml ..
+all: myplc.html
 
-# dont redo php by default, this requires plc_www (see above) 
-# that we build separately (has no doc/ subdir anyway)
-# note that the build host (myplc-devel) needs ghostscript
-# that we added only on 20 july 2007
-all: myplc.pdf myplc.html
+# XML - as opposed to SGML - requires an identifier - see 
+# http://www.docbook.org/tdg/en/html/appb.html
+# and, openjade opens http connections when using the official URL 
+# as an identifier; this is slow, and sometimes fails and breaks the build
 
-static: pyplc.php
+# locating locally installed docbook43 dtd - fedora-specific
+remote-docbook-43 = http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd
+local-docbook-43 = $(wildcard /usr/share/sgml/docbook/xml-dtd-4.3-*/docbookx.dtd)
+docbook-43=$(if $(local-docbook-43),$(local-docbook-43),$(remote-docbook-43))
 
-.PHONY: all
+myplc.xml: myplc.xml.in
+       $(if $(local-docbook-43), \
+       echo Using locally installed DTD $(local-docbook-43), \
+       echo WARNING - could not locate local DTD - using remote $(remote-docbook-43))
+       sed -e s:@DOCBOOK-43@:$(docbook-43): $< > $@
 
 # Dependencies
-.myplc.xml.valid: architecture.eps architecture.png plc_variables.xml plc_devel_variables.xml
+.myplc.xml.valid: architecture.eps architecture.png plc_variables.xml 
 
-%_variables.xml: variables.xsl %_config.xml
+plc_variables.xml: variables.xsl ../default_config.xml
        xsltproc $(XSLFLAGS) --output $@ $^
 
 # Validate the XML
 .%.xml.valid: %.xml
        xmllint --valid --output $@ $<
 
+# docbook2pdf craps out on figures
+%.pdf: %.ps
+       ps2pdf $< $@
+
 # Compile it into other formats
 FORMATS := dvi html man ps rtf tex texi txt
 
@@ -40,19 +49,9 @@ define docbook2
        docbook2$(1) --nochunks $$(DOCBOOK2FLAGS) $$<
 endef
 
-# docbook2pdf craps out on figures
-%.pdf: %.ps
-       ps2pdf $< $@
-
-# PHP for the website
-%.php: GenDoc.xsl .%.xml.valid
-       xsltproc $(XSLFLAGS) --output $@ $^
-
 $(foreach format,$(FORMATS),$(eval $(call docbook2,$(format))))
 
-docclean:
-       rm -f $(patsubst %,*.%,$(FORMATS)) *.pdf *.php .*.xml.valid variables.xml 
-
-clean: docclean
+clean:
+       rm -f $(patsubst %,*.%,$(FORMATS)) *.pdf .*.xml.valid plc_variables.xml 
 
-.PHONY: docclean
+.PHONY: all docclean