clearer names for actions, and infer actions better
[monitor.git] / docs / Makefile
1 #
2 # (Re)builds API documentation
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2006 The Trustees of Princeton University
6 #
7 # $Id: Makefile 5574 2007-10-25 20:33:17Z thierry $
8 #
9
10 all: Monitor.html
11 Monitor.html:
12         touch Monitor.html
13 Monitor.pdf:
14         touch Monitor.pdf
15
16 # XML - as opposed to SGML - requires an identifier - see 
17 # http://www.docbook.org/tdg/en/html/appb.html
18 # and, openjade opens http connections when using the official URL 
19 # as an identifier; this is slow, and sometimes fails and breaks the build
20
21 # locating locally installed docbook43 dtd - fedora-specific
22 remote-docbook-43 = http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd
23 local-docbook-43 = $(wildcard /usr/share/sgml/docbook/xml-dtd-4.3-*/docbookx.dtd)
24 docbook-43=$(if $(local-docbook-43),$(local-docbook-43),$(remote-docbook-43))
25
26 Monitor.xml: Monitor.xml.in
27         $(if $(local-docbook-43), \
28         echo Using locally installed DTD $(local-docbook-43), \
29         echo WARNING - could not locate local DTD - using remote $(remote-docbook-43))
30         sed -e s:@DOCBOOK-43@:$(docbook-43): $< > $@
31
32 .Monitor.xml.valid: Methods.xml
33
34 MONITOR_SOURCES = ../web/MonitorWeb/monitorweb/monitor_xmlrpc.py
35
36 # path needs to mention PLCAPI/doc (for DocBook) and PLCAPI/ (for PLC.Parameter)
37 Methods.xml: DocBookLocal.py $(MONITOR_SOURCES)
38         PYTHONPATH=..:../../PLCAPI:../../PLCAPI/doc:../web/MonitorWeb/monitorweb ./DocBookLocal.py > $@
39
40 #
41 # Documentation
42 #
43
44 # Validate the XML
45 .%.xml.valid: %.xml
46         xmllint --valid --output $@ $<
47
48 # Remove the temporary output file after compilation
49 .SECONDARY: .%.xml.valid
50
51 # Compile it into other formats
52 FORMATS := dvi html man ps pdf rtf tex texi txt
53
54 DOCBOOK2FLAGS := -V biblio-number=1
55
56 define docbook2
57 %.$(1): %.xml .%.xml.valid
58         docbook2$(1) --nochunks $$(DOCBOOK2FLAGS) $$<
59 endef
60
61 $(foreach format,$(FORMATS),$(eval $(call docbook2,$(format))))
62
63 clean:
64         rm -f $(patsubst %,*.%,$(FORMATS)) .*.xml.valid Methods.xml
65
66 .PHONY: clean all