MOFILES = $(addsuffix .mo,$(LINGUAS))
POTFILE = $(OCAML_GETTEXT_PACKAGE).pot
-all: $(MOFILES) $(POTFILE)
+all: ../.tmp.virt-p2v.ml $(MOFILES) $(POTFILE)
+
+# This is just a hack because ocaml-gettext doesn't know what to
+# do with a file that doesn't end in a *.ml extension, and even
+# if renamed it doesn't work because of the toplevel directives.
+../.tmp.virt-p2v.ml: ../virt-p2v
+ grep -v '^#' < $< > $@
install: install-po
$(OCAML_GETTEXT) --action extract $(OCAML_GETTEXT_EXTRACT_OPTIONS) \
--extract-pot $@ $<
+# Also includes a fix for incorrectly escaped multi-byte sequences.
%.po: $(POTFILE)
$(OCAML_GETTEXT) --action merge $(OCAML_GETTEXT_MERGE_OPTIONS) \
--merge-pot $(POTFILE) $@
+ mv $@ $@.orig
+ perl -wpe 's/\\(\d{3})/pack "C*", $$1/ge' < $@.orig > $@
$(BUILDPO):
mkdir -p $(BUILDPO)