1 # Makefile for po subdirectory.
4 # Copyright (C) 2007-2008 Red Hat Inc.
5 # Written by Richard W.M. Jones <rjones@redhat.com>
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.
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.
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
21 OCAML_GETTEXT_PACKAGE = virt-top
22 LINGUAS = $(shell cat LINGUAS)
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 =
31 PODIR = @prefix@/share/locale
33 POFILES = $(addsuffix .po,$(LINGUAS))
34 MOFILES = $(addsuffix .mo,$(LINGUAS))
35 POTFILE = $(OCAML_GETTEXT_PACKAGE).pot
37 all: $(MOFILES) $(POTFILE)
41 uninstall: uninstall-po
46 $(OCAML_GETTEXT) --action compile $(OCAML_GETTEXT_COMPILE_OPTIONS) \
47 --compile-output $@ $^
49 %.pot: $(SOURCES) $(shell cat $(SOURCES))
50 $(OCAML_GETTEXT) --action extract $(OCAML_GETTEXT_EXTRACT_OPTIONS) \
53 # Also includes a fix for incorrectly escaped multi-byte sequences.
55 $(OCAML_GETTEXT) --action merge $(OCAML_GETTEXT_MERGE_OPTIONS) \
56 --merge-pot $(POTFILE) $@
58 perl -wpe 's/\\(\d{3})/pack "C*", $$1/ge' < $@.orig > $@
65 install-po: $(MOFILES)
66 $(OCAML_GETTEXT) --action install $(OCAML_GETTEXT_INSTALL_OPTIONS) \
67 --install-textdomain $(OCAML_GETTEXT_PACKAGE) \
68 --install-destdir $(PODIR) $(MOFILES)
71 $(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
72 --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
73 --uninstall-orgdir $(PODIR) $(MOFILES)
76 -$(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \
77 --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \
78 --uninstall-orgdir $(BUILDPO) $(MOFILES)