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