1# Example for use of GNU gettext. 2# This file is in the public domain. 3# 4# Makefile configuration - processed by automake. 5 6# List of files which contain translatable strings. 7POTFILES = \ 8 hello.jl.in 9 10# Usually the message domain is the same as the package name. 11DOMAIN = $(PACKAGE) 12 13# These options get passed to xgettext. 14XGETTEXT_OPTIONS = 15 16# This is the copyright holder that gets inserted into the header of the 17# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 18# package. (Note that the msgstr strings, extracted from the package's 19# sources, belong to the copyright holder of the package.) Translators are 20# expected to transfer the copyright for their translations to this person 21# or entity, or to disclaim their copyright. The empty string stands for 22# the public domain; in this case the translators are expected to disclaim 23# their copyright. 24COPYRIGHT_HOLDER = Yoyodyne, Inc. 25 26# This is the email address or URL to which the translators shall report 27# bugs in the untranslated strings: 28# - Strings which are not entire sentences, see the maintainer guidelines 29# in the GNU gettext documentation, section 'Preparing Strings'. 30# - Strings which use unclear terms or require additional context to be 31# understood. 32# - Strings which make invalid assumptions about notation of date, time or 33# money. 34# - Pluralisation problems. 35# - Incorrect English spelling. 36# - Incorrect formatting. 37# It can be your email address, or a mailing list address where translators 38# can write to without being subscribed, or the URL of a web page through 39# which the translators can contact you. 40MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org 41 42# This is the list of locale categories, beyond LC_MESSAGES, for which the 43# message catalogs shall be used. It is usually empty. 44EXTRA_LOCALE_CATEGORIES = 45 46MSGMERGE = msgmerge 47MSGMERGE_UPDATE = @MSGMERGE@ --update 48MSGINIT = msginit 49MSGCONV = msgconv 50MSGFILTER = msgfilter 51 52# This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file)) 53POTFILES_DEPS = @POTFILES_DEPS@ 54 55# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po) 56POFILES = @POFILES@ 57# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).gmo) 58GMOFILES = @GMOFILES@ 59# This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update) 60UPDATEPOFILES = @UPDATEPOFILES@ 61# This is computed as $(foreach lang, $(LINGUAS), $(lang).nop) 62DUMMYPOFILES = @DUMMYPOFILES@ 63 64# This is computed as 65# $(foreach lang, user-specified subset of $(LINGUAS), $(lang).gmo) 66CATALOGS = @CATALOGS@ 67 68SUFFIXES = .po .gmo .mo .sed .sin .nop .po-create .po-update 69 70.po.mo: 71 @echo "$(MSGFMT) -c -o $@ $<"; \ 72 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ 73 74.po.gmo: 75 @lang=`echo $* | sed -e 's,.*/,,'`; \ 76 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 77 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ 78 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo 79 80.sin.sed: 81 sed -e '/^#/d' $< > t-$@ 82 mv t-$@ $@ 83 84 85all-local: all-local-@USE_NLS@ 86 87all-local-yes: stamp-po 88all-local-no: 89 90# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no 91# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because 92# we don't want to bother translators with empty POT files). We assume that 93# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. 94# In this case, stamp-po is a nop (i.e. a phony target). 95 96# stamp-po is a timestamp denoting the last time at which the CATALOGS have 97# been loosely updated. Its purpose is that when a developer or translator 98# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, 99# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent 100# invocations of "make" will do nothing. This timestamp would not be necessary 101# if updating the $(CATALOGS) would always touch them; however, the rule for 102# $(POFILES) has been designed to not touch files that don't need to be 103# changed. 104stamp-po: $(srcdir)/$(DOMAIN).pot 105 test ! -f $(srcdir)/$(DOMAIN).pot || \ 106 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) 107 @test ! -f $(srcdir)/$(DOMAIN).pot || { \ 108 echo "touch stamp-po" && \ 109 echo timestamp > stamp-poT && \ 110 mv stamp-poT stamp-po; \ 111 } 112 113# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', 114# otherwise packages like GCC can not be built if only parts of the source 115# have been downloaded. 116 117# This target rebuilds $(DOMAIN).pot; it is an expensive operation. 118# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. 119$(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed 120 if LC_ALL=C grep 'GNU $(PACKAGE)' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \ 121 package_gnu='GNU '; \ 122 else \ 123 package_gnu=''; \ 124 fi; \ 125 if test -n '$(MSGID_BUGS_ADDRESS)'; then \ 126 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ 127 else \ 128 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ 129 fi; \ 130 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ 131 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ 132 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ 133 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ 134 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 135 --msgid-bugs-address="$$msgid_bugs_address" \ 136 $(POTFILES) \ 137 ;; \ 138 *) \ 139 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ 140 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ 141 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 142 --package-name="$${package_gnu}$(PACKAGE)" \ 143 --package-version='$(VERSION)' \ 144 --msgid-bugs-address="$$msgid_bugs_address" \ 145 $(POTFILES) \ 146 ;; \ 147 esac 148 test ! -f $(DOMAIN).po || { \ 149 if test -f $(srcdir)/$(DOMAIN).pot; then \ 150 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ 151 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ 152 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ 153 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ 154 else \ 155 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ 156 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ 157 fi; \ 158 else \ 159 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ 160 fi; \ 161 } 162 163# This rule has no dependencies: we don't need to update $(DOMAIN).pot at 164# every "make" invocation, only create it when it is missing. 165# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. 166$(srcdir)/$(DOMAIN).pot: 167 $(MAKE) $(DOMAIN).pot-update 168 169# This target rebuilds a PO file if $(DOMAIN).pot has changed. 170# Note that a PO file is not touched if it doesn't need to be changed. 171$(POFILES): $(srcdir)/$(DOMAIN).pot 172 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ 173 if test -f "$(srcdir)/$${lang}.po"; then \ 174 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 175 echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ 176 cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ 177 else \ 178 $(MAKE) $${lang}.po-create; \ 179 fi 180 181 182install-data-local: install-data-local-@USE_NLS@ 183install-data-local-no: all-local 184install-data-local-yes: all-local 185 $(mkdir_p) $(DESTDIR)$(datadir) 186 @catalogs='$(CATALOGS)'; \ 187 for cat in $$catalogs; do \ 188 cat=`basename $$cat`; \ 189 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 190 dir=$(localedir)/$$lang/LC_MESSAGES; \ 191 $(mkdir_p) $(DESTDIR)$$dir; \ 192 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ 193 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ 194 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ 195 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 196 if test -n "$$lc"; then \ 197 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 198 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 199 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 200 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 201 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 202 for file in *; do \ 203 if test -f $$file; then \ 204 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 205 fi; \ 206 done); \ 207 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 208 else \ 209 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 210 :; \ 211 else \ 212 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 213 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 214 fi; \ 215 fi; \ 216 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 217 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 218 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 219 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 220 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ 221 fi; \ 222 done; \ 223 done 224 225installdirs-local: installdirs-local-@USE_NLS@ 226installdirs-local-no: 227installdirs-local-yes: 228 $(mkdir_p) $(DESTDIR)$(datadir) 229 @catalogs='$(CATALOGS)'; \ 230 for cat in $$catalogs; do \ 231 cat=`basename $$cat`; \ 232 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 233 dir=$(localedir)/$$lang/LC_MESSAGES; \ 234 $(mkdir_p) $(DESTDIR)$$dir; \ 235 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 236 if test -n "$$lc"; then \ 237 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 238 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 239 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 240 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 241 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 242 for file in *; do \ 243 if test -f $$file; then \ 244 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 245 fi; \ 246 done); \ 247 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 248 else \ 249 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 250 :; \ 251 else \ 252 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 253 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 254 fi; \ 255 fi; \ 256 fi; \ 257 done; \ 258 done 259 260uninstall-local: uninstall-local-@USE_NLS@ 261uninstall-local-no: 262uninstall-local-yes: 263 catalogs='$(CATALOGS)'; \ 264 for cat in $$catalogs; do \ 265 cat=`basename $$cat`; \ 266 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 267 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ 268 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 269 done; \ 270 done 271 272html ID: 273 274MOSTLYCLEANFILES = 275MOSTLYCLEANFILES += remove-potcdate.sed 276MOSTLYCLEANFILES += stamp-poT 277MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po 278MOSTLYCLEANFILES += *.o 279 280DISTCLEANFILES = *.mo 281 282MAINTAINERCLEANFILES = stamp-po $(GMOFILES) 283 284EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(GMOFILES) 285 286# Hidden from automake, but really activated. Works around an automake-1.5 bug. 287#distdir: distdir1 288distdir1: 289 $(MAKE) update-po 290 if test -f $(srcdir)/$(DOMAIN).pot; then \ 291 for file in $(DOMAIN).pot stamp-po; do \ 292 if test -f $$file; then d=.; else d=$(srcdir); fi; \ 293 cp -p $$d/$$file $(distdir)/$$file || exit 1; \ 294 done; \ 295 fi 296 297update-po: Makefile 298 $(MAKE) $(DOMAIN).pot-update 299 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) 300 $(MAKE) update-gmo 301 302# General rule for creating PO files. 303 304.nop.po-create: 305 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ 306 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ 307 exit 1 308 309# General rule for updating PO files. 310 311.nop.po-update: 312 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ 313 tmpdir=`pwd`; \ 314 echo "$$lang:"; \ 315 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 316 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ 317 cd $(srcdir); \ 318 if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ 319 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 320 rm -f $$tmpdir/$$lang.new.po; \ 321 else \ 322 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 323 :; \ 324 else \ 325 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 326 exit 1; \ 327 fi; \ 328 fi; \ 329 else \ 330 echo "msgmerge for $$lang.po failed!" 1>&2; \ 331 rm -f $$tmpdir/$$lang.new.po; \ 332 fi 333 334$(DUMMYPOFILES): 335 336update-gmo: Makefile $(GMOFILES) 337 @: 338