c8b155d09d97c4f8454ffb984fb95662ef0fc3fc
[ntk/apt.git] / buildlib / xml_manpage.mak
1 # -*- make -*-
2
3 # This handles man pages in DocBook XML format. We convert to the respective
4 # output in the source directory then copy over to the final dest. This
5 # means xmlto is only needed if compiling from Arch
6
7 # Input
8 # $(SOURCE) - The documents to use, in the form foo.sect, ie apt-cache.8
9 # the XML files are called apt-cache.8.xml
10
11 # See defaults.mak for information about LOCAL
12
13 # Some local definitions
14 ifdef XMLTO
15
16 LOCAL := xml-manpage-$(firstword $(SOURCE))
17 $(LOCAL)-LIST := $(SOURCE)
18
19 # Install generation hooks
20 doc: $($(LOCAL)-LIST)
21 veryclean: veryclean/$(LOCAL)
22
23 $($(LOCAL)-LIST) :: % : %.xml $(INCLUDES)
24 echo Creating man page $@
25 $(XMLTO) man $<
26
27 # Clean rule
28 .PHONY: veryclean/$(LOCAL)
29 veryclean/$(LOCAL):
30 -rm -rf $($(@F)-LIST)
31
32 HAVE_XMLTO=yes
33 endif
34
35 INCLUDES :=
36
37 ifndef HAVE_XMLTO
38 # Strip from the source list any man pages we dont have compiled already
39 SOURCE := $(wildcard $(SOURCE))
40 endif
41
42 # Chain to the manpage rule
43 ifneq ($(words $(SOURCE)),0)
44 include $(MANPAGE_H)
45 endif