Version 1.0.6.
[virt-top.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-top
22 LINGUAS         = $(shell cat LINGUAS)
23 SOURCES         = POTFILES
24
25 MSGFMT          = @MSGFMT@
26
27 OCAML_GETTEXT   = @OCAML_GETTEXT@
28 OCAML_GETTEXT_EXTRACT_OPTIONS =
29 OCAML_GETTEXT_COMPILE_OPTIONS =
30 OCAML_GETTEXT_INSTALL_OPTIONS =
31 OCAML_GETTEXT_MERGE_OPTIONS   =
32
33 PODIR           = @prefix@/share/locale
34
35 POFILES         = $(addsuffix .po,$(LINGUAS))
36 MOFILES         = $(addsuffix .mo,$(LINGUAS))
37 POTFILE         = $(OCAML_GETTEXT_PACKAGE).pot
38
39 all: $(MOFILES) $(POTFILE)
40
41 install: install-po
42
43 uninstall: uninstall-po
44
45 clean:: clean-po
46
47 %.mo: %.po
48         $(MSGFMT) -o $@ $^
49
50 %.pot: $(SOURCES) $(shell cat $(SOURCES))
51         $(OCAML_GETTEXT) --action extract $(OCAML_GETTEXT_EXTRACT_OPTIONS) \
52         --extract-pot $@ $<
53
54 # Also includes a fix for incorrectly escaped multi-byte sequences.
55 %.po: $(POTFILE)
56         $(OCAML_GETTEXT) --action merge   $(OCAML_GETTEXT_MERGE_OPTIONS) \
57         --merge-pot $(POTFILE) $@
58         mv $@ $@.orig
59         perl -wpe 's/\\(\d{3})/pack "C*", $$1/ge' < $@.orig > $@
60
61 $(BUILDPO):
62         mkdir -p $(BUILDPO)
63
64 .PRECIOUS: $(POTFILE) 
65
66 install-po: $(MOFILES) 
67         $(OCAML_GETTEXT) --action install $(OCAML_GETTEXT_INSTALL_OPTIONS) \
68         --install-textdomain $(OCAML_GETTEXT_PACKAGE) \
69         --install-destdir $(PODIR) $(MOFILES)
70
71 uninstall-po:
72         $(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
73         --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
74         --uninstall-orgdir $(PODIR) $(MOFILES)
75
76 clean-po:
77         -$(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
78         --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
79         --uninstall-orgdir $(BUILDPO) $(MOFILES)
80         -$(RM) $(MOFILES)