~youscribe/parted/3.1

« back to all changes in this revision

Viewing changes to doc/po4a.mk

  • Committer: Guilhem Lettron
  • Date: 2012-10-22 14:37:59 UTC
  • Revision ID: guilhem+ubuntu@lettron.fr-20121022143759-m403kecgz13sknvp
3.1 from tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# You must set the $(lang) variable when you include this makefile.
 
3
#
 
4
# You can use the $(po4a_translate_options) variable to specify additional
 
5
# options to po4a.
 
6
# For example: po4a_translate_options=-L KOI8-R -A KOI8-R
 
7
#
 
8
#
 
9
# This makefile deals with the manpages generated from POs with po4a, and
 
10
# should be included in an automake Makefile.am.
 
11
#
 
12
# The po must be named:
 
13
#   <man>.$(lang).po
 
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).
 
18
#
 
19
# The POs suffix is $(lang).po to allow dl10n to detect the outdated POs.
 
20
#
 
21
#
 
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.
 
24
#
 
25
 
 
26
mandir = $(mandir)/$(lang)
 
27
 
 
28
# Inform automake that we want to install some man pages in section 1, 5
 
29
# and 8.
 
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.
 
34
dist_man_MANS =
 
35
 
 
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
 
41
 
 
42
# For each .po, try to generate the man page
 
43
all-local:
 
44
        for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
 
45
                $(MAKE) $$(basename $${po%.$(lang).po}); \
 
46
        done
 
47
 
 
48
# Remove the man pages that were generated from a .po
 
49
clean-local:
 
50
        for po in `ls -1 $(srcdir)/*.$(lang).po 2>/dev/null`; do \
 
51
                rm -f $$(basename $${po%.$(lang).po}); \
 
52
        done
 
53
 
 
54
.PHONY: updatepo
 
55
# Update the PO in srcdir, according to the POT in C.
 
56
# Based on the gettext po/Makefile.in.in
 
57
updatepo:
 
58
        tmpdir=`pwd`; \
 
59
        cd $(srcdir); \
 
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; \
 
67
            else \
 
68
              if mv -f $$tmpdir/$${po%po}new.po $$po; then \
 
69
                :; \
 
70
              else \
 
71
                echo "msgmerge for $$po failed: cannot move $$tmpdir/$${po%po}new.po to $$po" 1>&2; \
 
72
                exit 1; \
 
73
              fi; \
 
74
            fi; \
 
75
          else \
 
76
            echo "msgmerge for $$po failed!" 1>&2; \
 
77
            rm -f $$tmpdir/$${po%po}new.po; \
 
78
          fi; \
 
79
          msgfmt -o /dev/null --statistics $$po; \
 
80
        done
 
81
 
 
82
dist-hook: updatepo
 
83
 
 
84
# Build the pages
 
85
partprobe.8:
 
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) ; \
 
90
                fi ; \
 
91
        done