1# Gettext stuff; based on the contents of the Makefile.in.in file 2# distributed with GNU Gettext. 3# 4# The original copyright notice follows: 5# 6# Makefile for PO directory in any package using GNU gettext. 7# Copyright (C) 1995-1997, 2000-2007 by Ulrich Drepper <drepper@gnu.ai.mit.edu> 8# 9# This file can be copied and used freely without restrictions. It can 10# be used in projects which are not available under the GNU General Public 11# License but which still want to provide support for the GNU gettext 12# functionality. 13# Please note that the actual code of GNU gettext is covered by the GNU 14# General Public License and is *not* in the public domain. 15# 16# Origin: gettext-0.17 17 18DOMAIN += $(GETTEXT_PACKAGE) 19 20MSGFMT := $(shell which msgfmt) 21 22XGETTEXT := $(shell which xgettext) 23 24MSGMERGE := $(shell which msgmerge) 25 26MSGMERGE_UPDATE := $(MSGMERGE) --update 27 28POFILES += $(shell ls $(srcdir)/Source/WebCore/platform/gtk/po/*.po) 29 30PO_LINGUAS += $(patsubst $(srcdir)/Source/WebCore/platform/gtk/po/%.po,%,$(POFILES)) 31 32USER_LINGUAS += $(filter $(LINGUAS),$(PO_LINGUAS)) 33 34USE_LINGUAS += $(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else LLINGUAS="$(PO_LINGUAS)"; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) 35 36MOFILES += $(USE_LINGUAS:%=Source/WebCore/platform/gtk/po/%.mo) 37 38ALL_MOFILES += $(shell echo $(POFILES) | tr ' ' '\n' | sed "s,^$(srcdir)/,,g" | sed 's/\.po/.mo/g') 39 40.po.mo: 41 test -d Source/WebCore/platform/gtk/po/ || mkdir -p Source/WebCore/platform/gtk/po/ 42 @echo "$(MSGFMT) -c -o $@ $<"; \ 43 $(MSGFMT) -c -o $@ $< 44 45# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no 46# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because 47# we don't want to bother translators with empty POT files). We assume that 48# LINGUAS is empty in this case, i.e. $(POFILES) and $(MOFILES) are empty. 49# In this case, stamp-po is a nop (i.e. a phony target). 50 51# stamp-po is a timestamp denoting the last time at which the CATALOGS have 52# been loosely updated. Its purpose is that when a developer or translator 53# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, 54# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent 55# invocations of "make" will do nothing. This timestamp would not be necessary 56# if updating the $(CATALOGS) would always touch them; however, the rule for 57# $(POFILES) has been designed to not touch files that don't need to be 58# changed. 59stamp-po: $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot $(MOFILES) 60 test ! -d $(top_builddir)/Source/WebCore/platform/gtk/po || \ 61 mkdir -p $(top_builddir)/Source/WebCore/platform/gtk/po 62 test ! -f $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot || \ 63 test -z "$(MOFILES)" || $(MAKE) $(MOFILES) 64 @test ! -f $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot || { \ 65 echo "touch stamp-po" && \ 66 echo timestamp > stamp-poT && \ 67 mv stamp-poT stamp-po; \ 68 } 69 70# This target rebuilds $(DOMAIN).pot; it is an expensive operation. 71# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. 72$(DOMAIN).pot-update: $(POTFILES) $(top_builddir)/Source/WebCore/platform/gtk/po/POTFILES 73 test -d Source/WebCore/platform/gtk/po/ || mkdir -p Source/WebCore/platform/gtk/po/ 74 package_gnu=''; \ 75 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ 76 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ 77 else \ 78 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ 79 fi; \ 80 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ 81 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ 82 $(XGETTEXT) \ 83 --default-domain=$(DOMAIN) \ 84 --directory=$(srcdir) \ 85 --directory=$(srcdir)/Source/WebCore/platform/gtk \ 86 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ 87 --files-from=$(top_builddir)/Source/WebCore/platform/gtk/po/POTFILES \ 88 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 89 --msgid-bugs-address="$$msgid_bugs_address" \ 90 --keyword=_ \ 91 --keyword=N_ \ 92 -o $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot \ 93 ;; \ 94 *) \ 95 $(XGETTEXT) \ 96 --default-domain=$(DOMAIN) \ 97 --directory=$(srcdir) \ 98 --directory=$(srcdir)/Source/WebCore/platform/gtk \ 99 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ 100 --files-from=$(top_builddir)/Source/WebCore/platform/gtk/po/POTFILES \ 101 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 102 --package-name="$${package_gnu}@PACKAGE@" \ 103 --package-version='@VERSION@' \ 104 --msgid-bugs-address="$$msgid_bugs_address" \ 105 --keyword=_ \ 106 --keyword=N_ \ 107 -o $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot \ 108 ;; \ 109 esac 110 111# This rule has no dependencies: we don't need to update $(DOMAIN).pot at 112# every "make" invocation, only create it when it is missing. 113# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. 114$(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot: 115 $(MAKE) $(DOMAIN).pot-update 116 117# This target rebuilds a PO file if $(DOMAIN).pot has changed. 118# Note that a PO file is not touched if it doesn't need to be changed. 119update-po-files: $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot 120 @for pofile in $(POFILES); do \ 121 lang=`echo $$pofile | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ 122 if test -f "$(srcdir)/Source/WebCore/platform/gtk/po/$${lang}.po"; then \ 123 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(top_srcdir)/Source/WebCore/platform/gtk/po/$${lang}.po $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot"; \ 124 $(MSGMERGE_UPDATE) $(top_srcdir)/Source/WebCore/platform/gtk/po/$${lang}.po $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot; \ 125 else \ 126 $(MAKE) $${lang}.po-create; \ 127 fi; \ 128 done 129 130update-po: GNUmakefile 131 $(MAKE) $(DOMAIN).pot-update 132 $(MAKE) update-po-files 133 $(MAKE) $(MOFILES) 134 135.nop.po-create: 136 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ 137 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ 138 exit 1 139 140# clean rules 141CLEANFILES += \ 142 $(top_builddir)/stamp-po 143 144MAINTAINERCLEANFILES += \ 145 $(ALL_MOFILES) \ 146 $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot 147 148EXTRA_DIST += \ 149 $(srcdir)/Source/WebCore/platform/gtk/po/ChangeLog \ 150 $(srcdir)/Source/WebCore/platform/gtk/po/POTFILES.in \ 151 $(srcdir)/Source/WebCore/platform/gtk/po/README \ 152 $(wildcard $(srcdir)/Source/WebCore/platform/gtk/po/*.po) 153 154DISTCLEANFILES += \ 155 $(ALL_MOFILES) \ 156 $(top_builddir)/Source/WebCore/platform/gtk/po/$(DOMAIN).pot 157 158po-install-data-local: all 159 $(MKDIR_P) $(DESTDIR)$(datadir) 160 @catalogs='$(MOFILES)'; \ 161 for cat in $$catalogs; do \ 162 cat=`basename $$cat`; \ 163 lang=`echo $$cat | sed -e 's/\.mo$$//'`; \ 164 dir=$(localedir)/$$lang/LC_MESSAGES; \ 165 $(MKDIR_P) $(DESTDIR)$$dir; \ 166 if test -r Source/WebCore/platform/gtk/po/$$cat; then realcat=Source/WebCore/platform/gtk/po/$$cat; else realcat=$(srcdir)/$$cat; fi; \ 167 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ 168 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ 169 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 170 if test -n "$$lc"; then \ 171 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 172 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 173 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 174 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 175 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 176 for file in *; do \ 177 if test -f $$file; then \ 178 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 179 fi; \ 180 done); \ 181 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 182 else \ 183 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 184 :; \ 185 else \ 186 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 187 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 188 fi; \ 189 fi; \ 190 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 191 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 192 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 193 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 194 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ 195 fi; \ 196 done; \ 197 done 198 199po-installdirs-data-local: 200 $(MKDIR_P) $(DESTDIR)$(datadir) 201 @catalogs='$(MOFILES)'; \ 202 for cat in $$catalogs; do \ 203 cat=`basename $$cat`; \ 204 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 205 dir=$(localedir)/$$lang/LC_MESSAGES; \ 206 $(MKDIR_P) $(DESTDIR)$$dir; \ 207 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 208 if test -n "$$lc"; then \ 209 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 210 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 211 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 212 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 213 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 214 for file in *; do \ 215 if test -f $$file; then \ 216 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 217 fi; \ 218 done); \ 219 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 220 else \ 221 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 222 :; \ 223 else \ 224 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 225 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 226 fi; \ 227 fi; \ 228 fi; \ 229 done; \ 230 done 231 232po-uninstall-local: 233 catalogs='$(MOFILES)'; \ 234 for cat in $$catalogs; do \ 235 cat=`basename $$cat`; \ 236 lang=`echo $$cat | sed -e 's/\.mo$$//'`; \ 237 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ 238 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 239 done; \ 240 done 241 242install-data-local: po-install-data-local 243installdirs-data-local: po-installdirs-data-local 244uninstall-local: po-uninstall-local 245