Update FSF address.
[libguestfs.git] / po-docs / Makefile.am
1 # libguestfs translations of man pages and POD files
2 # Copyright (C) 2010-2011 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 # XXX The use of po4a is naive here.  Also we should integrate this
19 # into the po/ directory and the translations into the usual
20 # libguestfs.pot file.
21
22 # Languages.
23 LINGUAS = ja uk
24
25 EXTRA_DIST = \
26         libguestfs-docs.pot \
27         $(LINGUAS:%=%.po)
28
29 CLEANFILES = po4a.conf
30
31 # Build the final man pages from the translated POD files.  Each
32 # language directory contains a Makefile.am that we need to keep up to
33 # date (note each $lang/Makefile.am should be identical).
34 # XXX Is there a better way?
35 SUBDIRS = $(LINGUAS)
36
37 update-po: libguestfs-docs.pot
38
39 # Note: po4a leaves empty '=encoding' lines in POD files.  Also it
40 # includes a large warning message which ends up in the output.  We
41 # post-process the output to remove both.
42 libguestfs-docs.pot: po4a.conf
43         $(PO4A) \
44           -M utf-8 -L utf-8 -A utf-8 \
45           -v \
46           -k 0 \
47           --package-name $(PACKAGE_NAME) \
48           --package-version $(PACKAGE_VERSION) \
49           --msgid-bugs-address libguestfs@redhat.com \
50           --copyright-holder "Red Hat Inc." \
51           po4a.conf
52         for f in `find $(LINGUAS) -name '*.pod' -o -name '*.pl'`; do \
53           echo '=encoding utf8' > $$f.new; \
54           awk 'FNR >= 14 { print }' < $$f >> $$f.new; \
55           mv $$f.new $$f; \
56         done
57
58 po4a.conf: podfiles
59         rm -f $@-t
60         echo "[po_directory] ." >> $@-t
61         echo >> $@-t
62         for f in `cat podfiles`; do \
63           b=`basename -- $$f`; \
64           echo "[type: pod] $$f \$$lang:\$$lang/$$b" >> $@-t; \
65           echo >> $@-t; \
66         done;
67         mv $@-t $@
68
69 podfiles: Makefile
70         rm -f $@ $@-t
71         find $(top_srcdir) -name '*.pod' | \
72           grep -v /debian/ | \
73           grep -v /libguestfs-1 | \
74           grep -v /po-docs/ | \
75           grep -v /stamp- \
76           > $@-t
77         find $(top_srcdir)/tools -name 'virt-*.pl' >> $@-t
78         LC_ALL=C sort -o $@-t $@-t
79         mv $@-t $@