- separate manpages from the rest of the doc building
[ntk/apt.git] / doc / makefile
1 # -*- make -*-
2 BASE=..
3 SUBDIR=doc
4 SUBDIRS= $(dir $(wildcard */makefile))
5
6 # Bring in the default rules
7 include ../buildlib/defaults.mak
8
9 # Debian Doc SGML Documents
10 SOURCE = $(wildcard *.sgml)
11 DEBIANDOC_HTML_OPTIONS=-l en.UTF-8
12 include $(DEBIANDOC_H)
13
14 MANPAGEPO = $(patsubst %.po,%,$(notdir $(wildcard po/*.po)))
15 MANPAGEPOLIST = $(patsubst %,manpages-translation-%,$(MANPAGEPO))
16
17 doc: manpages
18
19 # Do not use XMLTO, build the manpages directly with XSLTPROC
20 ifdef XSLTPROC
21 # generate a list of accepted man page translations
22 SOURCE = $(patsubst %.xml,%,$(wildcard *.?.xml))
23 INCLUDES = apt.ent apt-verbatim.ent
24 STYLESHEET=manpage-style.xsl
25
26 LOCAL := manpage-$(firstword $(SOURCE))
27 $(LOCAL)-LIST := $(SOURCE)
28
29 # Install generation hooks
30 manpages: $(MANPAGEPOLIST) $($(LOCAL)-LIST)
31
32 $($(LOCAL)-LIST) :: % : %.xml $(INCLUDES)
33 echo Creating man page $@
34 $(XSLTPROC) -o $@ $(STYLESHEET) $<
35
36 $(MANPAGEPOLIST) :: manpages-translation-% : %/makefile po4a
37 $(MAKE) -C $(dir $<) doc
38
39 .PHONY: manpages dirs-manpage-subdirs $(MANPAGEPOLIST)
40 dirs: dirs-manpage-subdirs
41 dirs-manpage-subdirs:
42 for i in $(MANPAGEPO); do \
43 test -d $$i || mkdir $$i; \
44 test -f $$i/makefile || sed "s#@@LANG@@#$$i#" lang.makefile > $$i/makefile; \
45 done
46
47 # Clean rule
48 .PHONY: veryclean/$(LOCAL)
49 veryclean: veryclean/$(LOCAL)
50 veryclean/$(LOCAL):
51 -rm -rf $($(@F)-LIST)
52
53 endif
54
55 # Chain to the manpage rule
56 SOURCE = apt.8
57 include $(MANPAGE_H)
58
59 # Examples
60 SOURCE = examples/apt.conf examples/sources.list examples/configure-index examples/apt-https-method-example.conf
61 TO = $(DOC)
62 TARGET = binary
63 include $(COPY_H)
64
65 .PHONY: clean clean-subdirs veryclean veryclean-subdirs all binary doc
66
67 clean: clean-subdirs
68 veryclean: veryclean-subdirs
69
70 clean-subdirs:
71 for dir in $(SUBDIRS); do\
72 $(MAKE) -C $$dir clean; \
73 done
74
75 veryclean-subdirs:
76 for dir in $(SUBDIRS); do\
77 rm -rf $$dir; \
78 done
79
80 .PHONY: update-po po4a stats
81
82 ifdef PO4A
83 doc: po4a
84
85 update-po:
86 po4a --previous --no-backups --force --no-translations po4a.conf
87
88 po4a:
89 po4a --previous --no-backups po4a.conf
90 endif
91
92 stats:
93 for i in po/*.po; do echo -n "$$i: "; msgfmt --statistics $$i; done
94
95 ifdef DOXYGEN
96 DOXYGEN_SOURCES = $(shell find $(BASE)/apt-pkg -not -name .\\\#* -and \( -name \*.cc -or -name \*.h \) )
97
98 clean: doxygen-clean
99
100 doxygen-clean:
101 rm -fr $(BUILD)/doc/doxygen
102 rm -f $(BUILD)/doc/doxygen-stamp
103
104 $(BUILD)/doc/doxygen-stamp: $(DOXYGEN_SOURCES) $(BUILD)/doc/Doxyfile
105 rm -fr $(BUILD)/doc/doxygen
106 mkdir $(BUILD)/doc/doxygen # some versions seem to not create this directory #628799
107 $(DOXYGEN) $(BUILD)/doc/Doxyfile
108 touch $(BUILD)/doc/doxygen-stamp
109
110 doc: $(BUILD)/doc/doxygen-stamp
111 endif