9398e2fa267cf357420fbb3ad14e9a235f4024f6
[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 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: $(MOFILES) $(POTFILE)
38
39 install: install-po
40
41 uninstall: uninstall-po
42
43 clean:: clean-po
44
45 %.mo: %.po
46         $(OCAML_GETTEXT) --action compile $(OCAML_GETTEXT_COMPILE_OPTIONS) \
47         --compile-output $@ $^
48
49 %.pot: $(SOURCES) $(shell cat $(SOURCES))
50         $(OCAML_GETTEXT) --action extract $(OCAML_GETTEXT_EXTRACT_OPTIONS) \
51         --extract-pot $@ $<
52
53 # Also includes a fix for incorrectly escaped multi-byte sequences.
54 %.po: $(POTFILE)
55         $(OCAML_GETTEXT) --action merge   $(OCAML_GETTEXT_MERGE_OPTIONS) \
56         --merge-pot $(POTFILE) $@
57         mv $@ $@.orig
58         perl -wpe 's/\\(\d{3})/pack "C*", $$1/ge' < $@.orig > $@
59
60 $(BUILDPO):
61         mkdir -p $(BUILDPO)
62
63 .PRECIOUS: $(POTFILE) 
64
65 install-po: $(MOFILES) 
66         $(OCAML_GETTEXT) --action install $(OCAML_GETTEXT_INSTALL_OPTIONS) \
67         --install-textdomain $(OCAML_GETTEXT_PACKAGE) \
68         --install-destdir $(PODIR) $(MOFILES)
69
70 uninstall-po:
71         $(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
72         --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
73         --uninstall-orgdir $(PODIR) $(MOFILES)
74
75 clean-po:
76         -$(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
77         --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
78         --uninstall-orgdir $(BUILDPO) $(MOFILES)
79         -$(RM) $(MOFILES)