merged from donkult
[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 doc: manpages debiandoc
15
16 # Do not use XMLTO, build the manpages directly with XSLTPROC
17 ifdef XSLTPROC
18 # generate a list of accepted man page translations
19 SOURCE = $(patsubst %.xml,%,$(wildcard *.?.xml))
20 INCLUDES = apt.ent apt-verbatim.ent
21 STYLESHEET=manpage-style.xsl
22
23 LOCAL := manpage-$(firstword $(SOURCE))
24 $(LOCAL)-LIST := $(SOURCE)
25
26 # Install generation hooks
27 manpages: $($(LOCAL)-LIST)
28
29 $($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
30 echo Creating man page $@
31 $(XSLTPROC) -o $@ $(STYLESHEET) $<
32
33 # Clean rule
34 .PHONY: veryclean/$(LOCAL)
35 veryclean: veryclean/$(LOCAL)
36 veryclean/$(LOCAL):
37 -rm -rf $($(@F)-LIST)
38 endif
39
40 # Chain to the manpage rule
41 SOURCE = apt.8
42 include $(MANPAGE_H)
43
44 examples/sources.list: examples/sources.list.in apt-verbatim.ent
45 sed -e 's#&stable-codename;#$(shell grep --max-count=1 '^<!ENTITY stable-codename "' apt-verbatim.ent | cut -d'"' -f 2)#g' examples/sources.list.in > examples/sources.list
46
47 # Examples
48 SOURCE = examples/apt.conf examples/sources.list examples/configure-index examples/apt-https-method-example.conf
49 TO = $(DOC)
50 TARGET = binary
51 include $(COPY_H)
52
53 .PHONY: clean clean-subdirs veryclean veryclean-subdirs all binary doc stats
54
55 clean: clean-subdirs
56 veryclean: veryclean-subdirs
57
58 clean-subdirs:
59 for dir in $(SUBDIRS); do\
60 $(MAKE) -C $$dir clean; \
61 done
62
63 veryclean-subdirs:
64 for dir in $(SUBDIRS); do\
65 rm -rf $$dir; \
66 done
67
68 stats:
69 for i in po/*.po; do echo -n "$$i: "; msgfmt --output-file=/dev/null --statistics $$i; done
70
71 ifdef PO4A
72 DOCUMENTATIONPO = $(patsubst %.po,%,$(notdir $(wildcard po/*.po)))
73 MANPAGEPOLIST = $(addprefix manpages-translation-,$(DOCUMENTATIONPO))
74 DEBIANDOCPOLIST = $(addprefix debiandoc-translation-,$(DOCUMENTATIONPO))
75
76 MANPAGEDIRLIST = $(addsuffix /makefile,$(DOCUMENTATIONPO))
77
78 .PHONY: update-po po4a $(MANPAGEPOLIST) $(MANPAGEDIRLIST)
79
80 manpages: $(MANPAGEPOLIST)
81 debiandoc: $(DEBIANDOCPOLIST)
82 po4a: $(MANPAGEPOLIST) $(DEBIANDOCPOLIST)
83
84 update-po:
85 po4a --previous --no-backups --force --no-translations \
86 --package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \
87 --msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf
88
89 $(MANPAGEPOLIST) :: manpages-translation-% : %/makefile po4a.conf
90 po4a --previous --no-backups --translate-only $(dir $<)apt.ent \
91 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.1.xml,%.$(subst /,,$(dir $<)).1.xml,$(wildcard *.1.xml))) \
92 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.2.xml,%.$(subst /,,$(dir $<)).2.xml,$(wildcard *.2.xml))) \
93 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.3.xml,%.$(subst /,,$(dir $<)).3.xml,$(wildcard *.3.xml))) \
94 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.4.xml,%.$(subst /,,$(dir $<)).4.xml,$(wildcard *.4.xml))) \
95 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.5.xml,%.$(subst /,,$(dir $<)).5.xml,$(wildcard *.5.xml))) \
96 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.6.xml,%.$(subst /,,$(dir $<)).6.xml,$(wildcard *.6.xml))) \
97 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.7.xml,%.$(subst /,,$(dir $<)).7.xml,$(wildcard *.7.xml))) \
98 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.8.xml,%.$(subst /,,$(dir $<)).8.xml,$(wildcard *.8.xml))) \
99 --package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \
100 --msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf
101 $(MAKE) -C $(dir $<) manpages
102
103 $(DEBIANDOCPOLIST) :: debiandoc-translation-% : %/makefile po4a.conf
104 po4a --previous --no-backups --translate-only $(dir $<)apt.ent \
105 $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.sgml,%.$(subst /,,$(dir $<)).sgml,$(wildcard *.sgml))) \
106 --package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \
107 --msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf
108 $(MAKE) -C $(dir $<) debiandoc
109
110 dirs: $(MANPAGEDIRLIST)
111 $(MANPAGEDIRLIST) :: %/makefile : lang.makefile
112 test -d $(dir $@) || mkdir $(dir $@)
113 sed "s#@@LANG@@#$(subst /,,$(dir $@))#" $< > $@
114 endif
115
116 ifdef DOXYGEN
117 DOXYGEN_SOURCES = $(shell find $(BASE)/apt-pkg -not -name .\\\#* -and \( -name \*.cc -or -name \*.h \) )
118
119 clean: doxygen-clean
120
121 doxygen-clean:
122 rm -fr $(BUILD)/doc/doxygen
123 rm -f $(BUILD)/doc/doxygen-stamp
124
125 $(BUILD)/doc/doxygen-stamp: $(DOXYGEN_SOURCES) $(BUILD)/doc/Doxyfile
126 rm -fr $(BUILD)/doc/doxygen
127 mkdir $(BUILD)/doc/doxygen # some versions seem to not create this directory #628799
128 $(DOXYGEN) $(BUILD)/doc/Doxyfile
129 touch $(BUILD)/doc/doxygen-stamp
130
131 debiandoc: $(BUILD)/doc/doxygen-stamp
132 endif