aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/Makefile48
1 files changed, 33 insertions, 15 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 7018f5c6a447..1c955883cf58 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -20,6 +20,12 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
20# +--> DIR=file (htmldocs) 20# +--> DIR=file (htmldocs)
21# +--> man/ (mandocs) 21# +--> man/ (mandocs)
22 22
23
24# for PDF and PS output you can choose between xmlto and docbook-utils tools
25PDF_METHOD = $(prefer-db2x)
26PS_METHOD = $(prefer-db2x)
27
28
23### 29###
24# The targets that may be used. 30# The targets that may be used.
25.PHONY: xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs 31.PHONY: xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
@@ -93,27 +99,39 @@ C-procfs-example = procfs_example.xml
93C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) 99C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example))
94$(obj)/procfs-guide.xml: $(C-procfs-example2) 100$(obj)/procfs-guide.xml: $(C-procfs-example2)
95 101
96### 102notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
97# Rules to generate postscript, PDF and HTML 103 exit 1
98# db2html creates a directory. Generate a html file used for timestamp 104db2xtemplate = db2TYPE -o $(dir $@) $<
105xmltotemplate = xmlto TYPE $(XMLTOFLAGS) -o $(dir $@) $<
106
107# determine which methods are available
108ifeq ($(shell which db2ps >/dev/null 2>&1 && echo found),found)
109 use-db2x = db2x
110 prefer-db2x = db2x
111else
112 use-db2x = notfound
113 prefer-db2x = $(use-xmlto)
114endif
115ifeq ($(shell which xmlto >/dev/null 2>&1 && echo found),found)
116 use-xmlto = xmlto
117 prefer-xmlto = xmlto
118else
119 use-xmlto = notfound
120 prefer-xmlto = $(use-db2x)
121endif
99 122
100quiet_cmd_db2ps = XMLTO $@ 123# the commands, generated from the chosen template
101 cmd_db2ps = xmlto ps $(XMLTOFLAGS) -o $(dir $@) $< 124quiet_cmd_db2ps = PS $@
125 cmd_db2ps = $(subst TYPE,ps, $($(PS_METHOD)template))
102%.ps : %.xml 126%.ps : %.xml
103 @(which xmlto > /dev/null 2>&1) || \
104 (echo "*** You need to install xmlto ***"; \
105 exit 1)
106 $(call cmd,db2ps) 127 $(call cmd,db2ps)
107 128
108quiet_cmd_db2pdf = XMLTO $@ 129quiet_cmd_db2pdf = PDF $@
109 cmd_db2pdf = xmlto pdf $(XMLTOFLAGS) -o $(dir $@) $< 130 cmd_db2pdf = $(subst TYPE,pdf, $($(PDF_METHOD)template))
110%.pdf : %.xml 131%.pdf : %.xml
111 @(which xmlto > /dev/null 2>&1) || \
112 (echo "*** You need to install xmlto ***"; \
113 exit 1)
114 $(call cmd,db2pdf) 132 $(call cmd,db2pdf)
115 133
116quiet_cmd_db2html = XMLTO $@ 134quiet_cmd_db2html = HTML $@
117 cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \ 135 cmd_db2html = xmlto xhtml $(XMLTOFLAGS) -o $(patsubst %.html,%,$@) $< && \
118 echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \ 136 echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \
119 Goto $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ 137 Goto $(patsubst %.html,%,$(notdir $@))</a><p>' > $@
@@ -127,7 +145,7 @@ quiet_cmd_db2html = XMLTO $@
127 @if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \ 145 @if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \
128 cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi 146 cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
129 147
130quiet_cmd_db2man = XMLTO $@ 148quiet_cmd_db2man = MAN $@
131 cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; gzip -f $(obj)/man/*.9; fi 149 cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; gzip -f $(obj)/man/*.9; fi
132%.9 : %.xml 150%.9 : %.xml
133 @(which xmlto > /dev/null 2>&1) || \ 151 @(which xmlto > /dev/null 2>&1) || \