Make room for arch specific download directory.
[myplc.git] / doc / Makefile
1 #
2 # MyPLC documentation
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2006 The Trustees of Princeton University
6 #
7 # $Id$
8 #
9
10 all: myplc.html
11
12 # XML - as opposed to SGML - requires an identifier - see 
13 # http://www.docbook.org/tdg/en/html/appb.html
14 # and, openjade opens http connections when using the official URL 
15 # as an identifier; this is slow, and sometimes fails and breaks the build
16
17 # locating locally installed docbook43 dtd - fedora-specific
18 remote-docbook-43 = http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd
19 local-docbook-43 = $(wildcard /usr/share/sgml/docbook/xml-dtd-4.3-*/docbookx.dtd)
20 docbook-43=$(if $(local-docbook-43),$(local-docbook-43),$(remote-docbook-43))
21
22 myplc.xml: myplc.xml.in
23         $(if $(local-docbook-43), \
24         echo Using locally installed DTD $(local-docbook-43), \
25         echo WARNING - could not locate local DTD - using remote $(remote-docbook-43))
26         sed -e s:@DOCBOOK-43@:$(docbook-43): $< > $@
27
28 # Dependencies
29 .myplc.xml.valid: architecture.eps architecture.png plc_variables.xml 
30
31 plc_variables.xml: variables.xsl ../default_config.xml
32         xsltproc $(XSLFLAGS) --output $@ $^
33
34 # Validate the XML
35 .%.xml.valid: %.xml
36         xmllint --valid --output $@ $<
37
38 # docbook2pdf craps out on figures
39 %.pdf: %.ps
40         ps2pdf $< $@
41
42 # Compile it into other formats
43 FORMATS := dvi html man ps rtf tex texi txt
44
45 DOCBOOK2FLAGS := -V biblio-number=1
46
47 define docbook2
48 %.$(1): %.xml .%.xml.valid
49         docbook2$(1) --nochunks $$(DOCBOOK2FLAGS) $$<
50 endef
51
52 $(foreach format,$(FORMATS),$(eval $(call docbook2,$(format))))
53
54 clean:
55         rm -f $(patsubst %,*.%,$(FORMATS)) *.pdf .*.xml.valid plc_variables.xml 
56
57 .PHONY: all docclean