Added zh_CN to LINGUAS.
[virt-p2v.git] / po / Makefile.in
1 # Makefile for po subdirectory.
2 # @configure_input@
3 #
4 # Copyright (C) 2007-2008 Red Hat Inc.
5 # Written by Richard W.M. Jones <rjones@redhat.com>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21 OCAML_GETTEXT_PACKAGE = virt-p2v
22 LINGUAS         = $(shell cat LINGUAS)
23 SOURCES         = POTFILES
24
25 OCAML_GETTEXT   = @OCAML_GETTEXT@
26 OCAML_GETTEXT_EXTRACT_OPTIONS =
27 OCAML_GETTEXT_COMPILE_OPTIONS =
28 OCAML_GETTEXT_INSTALL_OPTIONS =
29 OCAML_GETTEXT_MERGE_OPTIONS   =
30
31 PODIR           = @prefix@/share/locale
32
33 POFILES         = $(addsuffix .po,$(LINGUAS))
34 MOFILES         = $(addsuffix .mo,$(LINGUAS))
35 POTFILE         = $(OCAML_GETTEXT_PACKAGE).pot
36
37 all: ../.tmp.virt-p2v.ml $(MOFILES) $(POTFILE)
38
39 # This is just a hack because ocaml-gettext doesn't know what to
40 # do with a file that doesn't end in a *.ml extension, and even
41 # if renamed it doesn't work because of the toplevel directives.
42 ../.tmp.virt-p2v.ml: ../virt-p2v
43         grep -v '^#' < $< > $@
44
45 install: install-po
46
47 uninstall: uninstall-po
48
49 clean:: clean-po
50
51 %.mo: %.po
52         $(OCAML_GETTEXT) --action compile $(OCAML_GETTEXT_COMPILE_OPTIONS) \
53         --compile-output $@ $^
54
55 %.pot: $(SOURCES) $(shell cat $(SOURCES))
56         $(OCAML_GETTEXT) --action extract $(OCAML_GETTEXT_EXTRACT_OPTIONS) \
57         --extract-pot $@ $<
58
59 # Also includes a fix for incorrectly escaped multi-byte sequences.
60 %.po: $(POTFILE)
61         $(OCAML_GETTEXT) --action merge   $(OCAML_GETTEXT_MERGE_OPTIONS) \
62         --merge-pot $(POTFILE) $@
63         mv $@ $@.orig
64         perl -wpe 's/\\(\d{3})/pack "C*", $$1/ge' < $@.orig > $@
65
66 $(BUILDPO):
67         mkdir -p $(BUILDPO)
68
69 .PRECIOUS: $(POTFILE) 
70
71 install-po: $(MOFILES) 
72         $(OCAML_GETTEXT) --action install $(OCAML_GETTEXT_INSTALL_OPTIONS) \
73         --install-textdomain $(OCAML_GETTEXT_PACKAGE) \
74         --install-destdir $(PODIR) $(MOFILES)
75
76 uninstall-po:
77         $(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
78         --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
79         --uninstall-orgdir $(PODIR) $(MOFILES)
80
81 clean-po:
82         -$(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
83         --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
84         --uninstall-orgdir $(BUILDPO) $(MOFILES)
85         -$(RM) $(MOFILES)