GETTEXT_PACKAGE ?= abiword LOCALE ?= $(LANG) MSGFMT = @MSGFMT@ MSGINIT = msginit INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ prefix = @prefix@ datarootdir = @datarootdir@ localedir = @localedir@ top_srcdir = @top_srcdir@ po_files = $(wildcard *.po) mo_files = $(subst .po,.mo, $(po_files)) langs = $(subst .po,, $(po_files)) catfile = $(localedir)/%s/LC_MESSAGES/$(GETTEXT_PACKAGE).mo instfile = $(subst %s,$(1),$(catfile)) .PHONY: all dist clean distclean distclean-recursive \ maintainer-clean maintainer-clean-recursive install uninstall \ update-po pot translate $(GETTEXT_PACKAGE).pot all: $(mo_files) dist: clean: rm -f $(mo_files) $(GETTEXT_PACKAGE).pot distclean distclean-recursive: clean rm -f LINGUAS POTFILES @if test -f Makefile.in; then rm -f Makefile; echo rm -f Makefile; fi rm -f missing maintainer-clean maintainer-clean-recursive: distclean-recursive install: all @$(foreach lang, $(langs), install -d $(dir $(call instfile,$(lang))); install -m 644 $(lang).mo $(call instfile,$(lang)); echo Installing $(call instfile,$(lang)); ) uninstall: @$(foreach lang, $(langs), if test -f $(call instfile,$(lang)); then rm -f $(call instfile,$(lang)); echo Uninstalling $(call instfile,$(lang)); fi; ) update-po: pot @$(foreach lang, $(langs), echo Updating locale $(lang); $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) $(lang); ) %.mo: %.po $(MSGFMT) -o $@ $< pot: $(GETTEXT_PACKAGE).pot translate: pot $(MSGINIT) --locale=$(LOCALE) $(GETTEXT_PACKAGE).pot: POTFILES.in $(INTLTOOL_UPDATE) --pot --gettext-package=$(GETTEXT_PACKAGE) # # And last, and certainly least, so that intltool won't throw a hissy fit: # INTLTOOL_MAKEFILE #