X-Git-Url: http://git.draconx.ca/gitweb/dxcommon.git/blobdiff_plain/7e65772a8de842e9bea15144bd1b8bc48b9240a3..ac1292661f52ce20168bb942ad207f5b935669ef:/snippet/gettext.mk diff --git a/snippet/gettext.mk b/snippet/gettext.mk new file mode 100644 index 0000000..3800114 --- /dev/null +++ b/snippet/gettext.mk @@ -0,0 +1,57 @@ +# Copyright © 2011-2012 Nick Bowler +# +# Automake fragment to distribute and install gettext .po/.mo files, intended +# for use in a non-recursive build setup. This does not include rules to +# generate the .pot file. Two variables must be defined: +# +# POFILES: the complete list of .po files included with the package, and +# MOFILES: the set of .mo files to be installed (a user-selected subset +# of the available options). +# +# One way to define these variables is to use the DX_LINGUAS autoconf macro +# which normally accompanies this fragment. +# +# License WTFPL2: Do What The Fuck You Want To Public License, version 2. +# This is free software: you are free to do what the fuck you want to. +# There is NO WARRANTY, to the extent permitted by law. + +ALL_MOFILES = $(POFILES:.po=.mo) +EXTRA_DIST += po/LINGUAS $(POFILES) $(ALL_MOFILES) +MAINTAINERCLEANFILES += $(ALL_MOFILES) + +.po.mo: + $(AM_V_at) $(MKDIR_P) $(@D) + $(AM_V_GEN) $(MSGFMT) $(MSGFMTFLAGS) -c -o $@ $< + +install-data-local: install-mofiles +install-mofiles: $(MOFILES) + for mo in $?; do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; $(MKDIR_P) "$$inst") \ + || exit $$?; \ + (set -x; $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo") \ + || exit $$?; \ + done +.PHONY: install-mofiles + +installdirs-local: installdirs-mofiles +installdirs-mofiles: + for mo in $(MOFILES); do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; $(MKDIR_P) "$$inst") || exit $$?; \ + done +.PHONY: installdirs-mofiles + +uninstall-local: uninstall-mofiles +uninstall-mofiles: + for mo in $(ALL_MOFILES); do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; cd "$$inst" && rm -f '$(PACKAGE).mo'); \ + done +.PHONY: uninstall-mofiles