merged from David, uncommited the previous i18n commit first as its part of the merge...
[ntk/apt.git] / buildlib / po4a_manpage.mak
CommitLineData
b01390ea
DK
1# -*- make -*-
2
3# This handles man pages with po4a. We convert to the respective
4# output in the source directory then copy over to the final dest. This
5# means po4a is only needed if compiling from bzr
6
7# Input
8# $(LC) - The language code of the translation
9
10# See defaults.mak for information about LOCAL
11
12# generate a list of accepted man page translations
13SOURCE = $(patsubst %.xml,%,$(wildcard *.$(LC).?.xml))
0c1a7101 14INCLUDES = apt.ent apt-verbatim.ent
b01390ea
DK
15
16# Do not use XMLTO, build the manpages directly with XSLTPROC
17ifdef XSLTPROC
18
1c8754c2 19STYLESHEET=manpage-style.xsl
b01390ea
DK
20
21LOCAL := po4a-manpage-$(firstword $(SOURCE))
22$(LOCAL)-LIST := $(SOURCE)
23
24# Install generation hooks
25doc: $($(LOCAL)-LIST)
26veryclean: veryclean/$(LOCAL)
27
0c1a7101
DK
28apt-verbatim.ent: ../apt-verbatim.ent
29 cp ../apt-verbatim.ent .
30
75f37d7d
DK
31manpage-style.xsl: ../manpage-style.xsl
32 sed "/<!-- LANGUAGE -->/ i\
33<xsl:param name=\"l10n.gentext.default.language\" select=\"'$(LC)'\" />" ../manpage-style.xsl > manpage-style.xsl
34
35$($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
b01390ea 36 echo Creating man page $@
b6d189ca 37 $(XSLTPROC) -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here???
9cdb1aab 38 test -f $(subst .$(LC),,$@) || echo FIXME: xsltproc respect the -o flag now, workaround can be removed
b01390ea
DK
39 mv -f $(subst .$(LC),,$@) $@
40
41# Clean rule
42.PHONY: veryclean/$(LOCAL)
43veryclean/$(LOCAL):
0c1a7101 44 -rm -rf $($(@F)-LIST) apt.ent apt-verbatim.ent apt.$(LC).8 \
93517da3
DK
45 $(addsuffix .xml,$($(@F)-LIST)) \
46 offline.$(LC).sgml guide.$(LC).sgml
b01390ea
DK
47
48HAVE_PO4A=yes
49endif
50
51# take care of the rest
7652e03e 52SOURCE := $(SOURCE) $(wildcard apt.$(LC).8)
b01390ea
DK
53INCLUDES :=
54
55ifndef HAVE_PO4A
56# Strip from the source list any man pages we dont have compiled already
57SOURCE := $(wildcard $(SOURCE))
58endif
59
60# Chain to the manpage rule
61ifneq ($(words $(SOURCE)),0)
62include $(MANPAGE_H)
63endif
7652e03e
DK
64
65# Debian Doc SGML Documents
66SOURCE := $(wildcard *.$(LC).sgml)
46e39c8e 67DEBIANDOC_HTML_OPTIONS=-l $(LC).UTF-8
7652e03e 68include $(DEBIANDOC_H)