reguire gnupg1 on f>=31; sense the system to use gpg1 when installed
[nodemanager.git] / doc / 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
8 all: NMAPI.html
9
10 # XML - as opposed to SGML - requires an identifier - see 
11 # http://www.docbook.org/tdg/en/html/appb.html
12 # and, openjade opens http connections when using the official URL 
13 # as an identifier; this is slow, and sometimes fails and breaks the build
14
15 # locating locally installed docbook43 dtd - fedora-specific
16 remote-docbook-43 = http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd
17 local-docbook-43 = $(wildcard /usr/share/sgml/docbook/xml-dtd-4.3-*/docbookx.dtd)
18 docbook-43=$(if $(local-docbook-43),$(local-docbook-43),$(remote-docbook-43))
19
20 NMAPI.xml: NMAPI.xml.in
21         $(if $(local-docbook-43), \
22         echo Using locally installed DTD $(local-docbook-43), \
23         echo WARNING - could not locate local DTD - using remote $(remote-docbook-43))
24         sed -e s,@DOCBOOK-43@,$(docbook-43), $< > $@
25
26 .NMAPI.xml.valid: Methods.xml
27
28 NM_SOURCES = ../api_calls.py
29
30 # path needs to mention PLCAPI/doc (for DocBook) and PLCAPI/ (for PLC.Parameter)
31 Methods.xml: DocBookLocal.py $(NM_SOURCES)
32         PYTHONPATH=..:../../plcapi:../../plcapi/doc ./DocBookLocal.py > $@
33
34 #
35 # Documentation
36 #
37
38 # Validate the XML
39 .%.xml.valid: %.xml
40         xmllint --valid --output $@ $<
41
42 # Remove the temporary output file after compilation
43 .SECONDARY: .%.xml.valid
44
45 # Compile it into other formats
46 FORMATS := dvi html man ps pdf rtf tex texi txt
47
48 DOCBOOK2FLAGS := -V biblio-number=1
49
50 define docbook2
51 %.$(1): %.xml .%.xml.valid
52         docbook2$(1) --nochunks $$(DOCBOOK2FLAGS) $$<
53 endef
54
55 $(foreach format,$(FORMATS),$(eval $(call docbook2,$(format))))
56
57 clean:
58         rm -f $(patsubst %,*.%,$(FORMATS)) .*.xml.valid Methods.xml
59
60 .PHONY: clean all