282777028cdb94cf9ea54a875a3190f59fc74d2d
[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., 675 Mass Ave, Cambridge, MA 02139, 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
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 # List of english POD sources which can be translated.
38 # Perl files count as POD as far as po4a is concerned.
39 PODFILES = \
40         ../src/guestfs.pod \
41         ../src/guestfs-actions.pod \
42         ../src/guestfs-availability.pod \
43         ../src/guestfs-structs.pod \
44         ../fish/guestfish.pod \
45         ../fish/guestfish-actions.pod \
46         ../fish/guestfish-commands.pod \
47         ../test-tool/libguestfs-test-tool.pod \
48         ../fuse/guestmount.pod \
49         $(wildcard ../tools/virt-*.pl)
50
51 update-po: libguestfs-docs.pot
52
53 # Note: po4a leaves empty '=encoding' lines in POD files.  Also it
54 # includes a large warning message which ends up in the output.  We
55 # post-process the output to remove both.
56 libguestfs-docs.pot: po4a.conf
57         $(PO4A) \
58           -M utf-8 -L utf-8 -A utf-8 \
59           -v \
60           -k 0 \
61           --package-name $(PACKAGE_NAME) \
62           --package-version $(PACKAGE_VERSION) \
63           --msgid-bugs-address libguestfs@redhat.com \
64           --copyright-holder "Red Hat Inc." \
65           po4a.conf
66         for f in `find $(LINGUAS) -name '*.pod' -o -name '*.pl'`; do \
67           awk 'FNR >= 14 { print }' < $$f > $$f.new; \
68           mv $$f.new $$f; \
69         done
70
71 po4a.conf: $(PODFILES)
72         rm -f $@-t
73         echo "[po_directory] ." >> $@-t
74         echo >> $@-t
75         for f in $(PODFILES); do \
76           b=`basename -- $$f`; \
77           echo "[type: pod] $$f \$$lang:\$$lang/$$b" >> $@-t; \
78           echo >> $@-t; \
79         done;
80         mv $@-t $@