2 # (Re)builds API documentation
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2006 The Trustees of Princeton University
7 # $Id: Makefile 5574 2007-10-25 20:33:17Z thierry $
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
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))
22 NMAPI.xml: NMAPI.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), $< > $@
28 .NMAPI.xml.valid: Methods.xml
30 NM_SOURCES = ../api_calls.py
32 # path needs to mention PLCAPI/doc (for DocBook) and PLCAPI/ (for PLC.Parameter)
33 Methods.xml: DocBookLocal.py $(NM_SOURCES)
34 PYTHONPATH=..:../../plcapi:../../plcapi/doc ./DocBookLocal.py > $@
42 xmllint --valid --output $@ $<
44 # Remove the temporary output file after compilation
45 .SECONDARY: .%.xml.valid
47 # Compile it into other formats
48 FORMATS := dvi html man ps pdf rtf tex texi txt
50 DOCBOOK2FLAGS := -V biblio-number=1
53 %.$(1): %.xml .%.xml.valid
54 docbook2$(1) --nochunks $$(DOCBOOK2FLAGS) $$<
57 $(foreach format,$(FORMATS),$(eval $(call docbook2,$(format))))
60 rm -f $(patsubst %,*.%,$(FORMATS)) .*.xml.valid Methods.xml