2 # You must set the $(lang) variable when you include this makefile.
4 # You can use the $(po4a_translate_options) variable to specify additional
6 # For example: po4a_translate_options=-L KOI8-R -A KOI8-R
9 # This makefile deals with the manpages generated from POs with po4a, and
10 # should be included in an automake Makefile.am.
12 # The po must be named:
14 # If a man page require an addendum, you must name it:
15 # <man>.$(lang).po.addendum
16 # Where <man> corresponds to a filename in the C directory (which contains
17 # the English man pages).
19 # The POs suffix is $(lang).po to allow dl10n to detect the outdated POs.
22 # If a man page cannot be generated (it is not sufficiently translated; the
23 # threshold is 80%), it won't be distributed, and the build won't fail.
26 mandir = @mandir@/$(lang)
28 # Inform automake that we want to install some man pages in section 1, 5
30 # We can't simply use:
31 # dist_man_MANS = $(wildcard *.[1-9])
32 # Because when Makefile.in is generated, dist_man_MANS is empty, and
33 # automake do not generate the install-man targets.
36 # Override the automake's install-man target.
37 # And set dist_man_MANS according to the pages that could be generated
38 # when this target is called.
39 install-man: dist_man_MANS = pt_BR-parted.8
40 install-man: install-man1 install-man5 install-man8
42 # For each .po, try to generate the man page
44 for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
45 $(MAKE) $$(basename $${po%.$(lang).po}); \
48 # Remove the man pages that were generated from a .po
50 for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
51 rm -f $$(basename $${po%.$(lang).po}); \
55 # Update the PO in srcdir, according to the POT in C.
56 # Based on the gettext po/Makefile.in.in
60 for po in *.$(lang).po; do \
61 case "$$po" in '*'*) continue;; esac; \
62 pot=../C/po/$${po%$(lang).po}pot; \
63 echo "$(MSGMERGE) $$po $$pot -o $${po%po}new.po"; \
64 if $(MSGMERGE) $$po $$pot -o $$tmpdir/$${po%po}new.po; then \
65 if cmp $$po $$tmpdir/$${po%po}new.po >/dev/null 2>&1; then \
66 rm -f $$tmpdir/$${po%po}new.po; \
68 if mv -f $$tmpdir/$${po%po}new.po $$po; then \
71 echo "msgmerge for $$po failed: cannot move $$tmpdir/$${po%po}new.po to $$po" 1>&2; \
76 echo "msgmerge for $$po failed!" 1>&2; \
77 rm -f $$tmpdir/$${po%po}new.po; \
79 msgfmt -o /dev/null --statistics $$po; \
86 for locale in pt_BR ; do \
87 po4a-translate -f man -m $(srcdir)/../C/$@ -p $@.$$locale.po -l $@ $(po4a_translate_options) ; \
88 if [ -f $(srcdir)/$@.$$locale.po.addendum ]; then \
89 po4a-translate -f man -m $(srcdir)/../C/$@ -p $@.$$locale.po -l $@ -a $(srcdir)/$@.$$locale.po.addendum $(po4a_translate_options) ; \