1 # Makefile for PO directory in any package using GNU gettext. 2 # Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper <drepper (a] gnu.ai.mit.edu> 3 # 4 # This file can be copied and used freely without restrictions. It can 5 # be used in projects which are not available under the GNU General Public 6 # License but which still want to provide support for the GNU gettext 7 # functionality. 8 # Please note that the actual code of GNU gettext is covered by the GNU 9 # General Public License and is *not* in the public domain. 10 # 11 # Origin: gettext-0.14 12 13 PACKAGE = @PACKAGE@ 14 VERSION = @VERSION@ 15 16 SHELL = /bin/sh 17 @SET_MAKE@ 18 19 srcdir = @srcdir@ 20 top_srcdir = @top_srcdir@ 21 VPATH = @srcdir@ 22 23 prefix = @prefix@ 24 exec_prefix = @exec_prefix@ 25 datarootdir = @datarootdir@ 26 datadir = @datadir@ 27 localedir = $(datadir)/locale 28 gettextsrcdir = $(datadir)/gettext/po 29 30 INSTALL = @INSTALL@ 31 INSTALL_DATA = @INSTALL_DATA@ 32 MKINSTALLDIRS = @MKINSTALLDIRS@ 33 mkinstalldirs = $(SHELL) $(MKINSTALLDIRS) 34 35 GMSGFMT = @GMSGFMT@ 36 MSGFMT = @MSGFMT@ 37 XGETTEXT = @XGETTEXT@ 38 MSGMERGE = msgmerge 39 MSGMERGE_UPDATE = @MSGMERGE@ --update 40 MSGINIT = msginit 41 MSGCONV = msgconv 42 MSGFILTER = msgfilter 43 44 POFILES = @POFILES@ 45 GMOFILES = @GMOFILES@ 46 UPDATEPOFILES = @UPDATEPOFILES@ 47 DUMMYPOFILES = @DUMMYPOFILES@ 48 DISTFILES.common = Makefile.in.in remove-potcdate.sin \ 49 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) 50 DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \ 51 $(POFILES) $(GMOFILES) \ 52 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) 53 54 POTFILES = \ 55 56 CATALOGS = @CATALOGS@ 57 58 # Makevars gets inserted here. (Don't remove this line!) 59 60 .SUFFIXES: 61 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update 62 63 .po.mo: 64 $(E) "$(MSGFMT) -c -o $@ $<" 65 $(Q) $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ 66 67 .po.gmo: 68 @lang=`echo $* | sed -e 's,.*/,,'`; \ 69 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 70 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ 71 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo 72 73 .sin.sed: 74 sed -e '/^#/d' $< > t-$@ 75 mv t-$@ $@ 76 77 78 all: all-@USE_NLS@ 79 80 all-yes: @MAINTAINER_CMT@stamp-po 81 all-no: 82 83 # stamp-po is a timestamp denoting the last time at which the CATALOGS have 84 # been loosely updated. Its purpose is that when a developer or translator 85 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, 86 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent 87 # invocations of "make" will do nothing. This timestamp would not be necessary 88 # if updating the $(CATALOGS) would always touch them; however, the rule for 89 # $(POFILES) has been designed to not touch files that don't need to be 90 # changed. 91 stamp-po: $(srcdir)/$(DOMAIN).pot 92 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) 93 @echo "touch stamp-po" 94 @echo timestamp > stamp-poT 95 @mv stamp-poT stamp-po 96 97 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', 98 # otherwise packages like GCC can not be built if only parts of the source 99 # have been downloaded. 100 101 # This target rebuilds $(DOMAIN).pot; it is an expensive operation. 102 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. 103 $(DOMAIN).pot-update: $(srcdir)/POTFILES.in remove-potcdate.sed \ 104 $(srcdir)/at-expand.pl 105 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ 106 --directory=$(top_builddir) \ 107 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ 108 --files-from=$(srcdir)/POTFILES.in \ 109 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 110 --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' 111 perl $(srcdir)/at-expand.pl < $(DOMAIN).po > $(DOMAIN).po.new 112 mv $(DOMAIN).po $(DOMAIN).po.bak 113 mv $(DOMAIN).po.new $(DOMAIN).po 114 test ! -f $(DOMAIN).po || { \ 115 if test -f $(srcdir)/$(DOMAIN).pot; then \ 116 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ 117 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ 118 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ 119 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ 120 else \ 121 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ 122 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ 123 fi; \ 124 else \ 125 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ 126 fi; \ 127 } 128 129 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at 130 # every "make" invocation, only create it when it is missing. 131 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update. 132 $(srcdir)/$(DOMAIN).pot: 133 $(MAKE) $(DOMAIN).pot-update 134 135 # This target rebuilds a PO file if $(DOMAIN).pot has changed. 136 # Note that a PO file is not touched if it doesn't need to be changed. 137 $(POFILES): $(srcdir)/$(DOMAIN).pot 138 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ 139 if test -f "$(srcdir)/$${lang}.po"; then \ 140 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 141 echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ 142 cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ 143 else \ 144 $(MAKE) $${lang}.po-create; \ 145 fi 146 147 148 install: install-exec install-data 149 install-exec: 150 install-data: install-data-@USE_NLS@ 151 if test "$(PACKAGE)" = "gettext-tools"; then \ 152 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ 153 for file in $(DISTFILES.common) Makevars.template; do \ 154 $(INSTALL_DATA) $(srcdir)/$$file \ 155 $(DESTDIR)$(gettextsrcdir)/$$file; \ 156 done; \ 157 for file in Makevars; do \ 158 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ 159 done; \ 160 else \ 161 : ; \ 162 fi 163 install-data-no: all 164 install-data-yes: all 165 $(mkinstalldirs) $(DESTDIR)$(datadir) 166 @catalogs='$(CATALOGS)'; \ 167 for cat in $$catalogs; do \ 168 cat=`basename $$cat`; \ 169 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 170 dir=$(localedir)/$$lang/LC_MESSAGES; \ 171 $(mkinstalldirs) $(DESTDIR)$$dir; \ 172 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ 173 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ 174 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ 175 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 176 if test -n "$$lc"; then \ 177 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 178 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 179 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 180 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 181 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 182 for file in *; do \ 183 if test -f $$file; then \ 184 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 185 fi; \ 186 done); \ 187 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 188 else \ 189 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 190 :; \ 191 else \ 192 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 193 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 194 fi; \ 195 fi; \ 196 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 197 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 198 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 199 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 200 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ 201 fi; \ 202 done; \ 203 done 204 205 install-strip: install 206 207 installdirs: installdirs-exec installdirs-data 208 installdirs-exec: 209 installdirs-data: installdirs-data-@USE_NLS@ 210 if test "$(PACKAGE)" = "gettext-tools"; then \ 211 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ 212 else \ 213 : ; \ 214 fi 215 installdirs-data-no: 216 installdirs-data-yes: 217 $(mkinstalldirs) $(DESTDIR)$(datadir) 218 @catalogs='$(CATALOGS)'; \ 219 for cat in $$catalogs; do \ 220 cat=`basename $$cat`; \ 221 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 222 dir=$(localedir)/$$lang/LC_MESSAGES; \ 223 $(mkinstalldirs) $(DESTDIR)$$dir; \ 224 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 225 if test -n "$$lc"; then \ 226 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 227 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 228 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 229 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 230 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 231 for file in *; do \ 232 if test -f $$file; then \ 233 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 234 fi; \ 235 done); \ 236 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 237 else \ 238 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 239 :; \ 240 else \ 241 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 242 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 243 fi; \ 244 fi; \ 245 fi; \ 246 done; \ 247 done 248 249 # Define this as empty until I found a useful application. 250 installcheck: 251 252 uninstall: uninstall-exec uninstall-data 253 uninstall-exec: 254 uninstall-data: uninstall-data-@USE_NLS@ 255 if test "$(PACKAGE)" = "gettext-tools"; then \ 256 for file in $(DISTFILES.common) Makevars.template; do \ 257 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ 258 done; \ 259 else \ 260 : ; \ 261 fi 262 uninstall-data-no: 263 uninstall-data-yes: 264 catalogs='$(CATALOGS)'; \ 265 for cat in $$catalogs; do \ 266 cat=`basename $$cat`; \ 267 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 268 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ 269 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 270 done; \ 271 done 272 273 check: all 274 275 info dvi ps pdf html tags TAGS ctags CTAGS ID: 276 277 mostlyclean: 278 rm -f remove-potcdate.sed 279 rm -f stamp-poT 280 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po 281 rm -f $(DOMAIN).po.bak 282 rm -fr *.o 283 284 clean: mostlyclean 285 286 distclean: clean 287 rm -f Makefile Makefile.in POTFILES *.mo 288 289 maintainer-clean: distclean 290 @echo "This command is intended for maintainers to use;" 291 @echo "it deletes files that may require special tools to rebuild." 292 rm -f stamp-po $(GMOFILES) 293 294 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) 295 dist distdir: 296 $(MAKE) update-po 297 @$(MAKE) dist2 298 # This is a separate target because 'update-po' must be executed before. 299 dist2: $(DISTFILES) 300 dists="$(DISTFILES)"; \ 301 if test "$(PACKAGE)" = "gettext-tools"; then \ 302 dists="$$dists Makevars.template"; \ 303 fi; \ 304 if test -f $(srcdir)/ChangeLog; then \ 305 dists="$$dists ChangeLog"; \ 306 fi; \ 307 for i in 0 1 2 3 4 5 6 7 8 9; do \ 308 if test -f $(srcdir)/ChangeLog.$$i; then \ 309 dists="$$dists ChangeLog.$$i"; \ 310 fi; \ 311 done; \ 312 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ 313 for file in $$dists; do \ 314 if test -f $$file; then \ 315 cp -p $$file $(distdir); \ 316 else \ 317 cp -p $(srcdir)/$$file $(distdir); \ 318 fi; \ 319 done 320 321 update-po: Makefile 322 $(MAKE) $(DOMAIN).pot-update 323 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) 324 $(MAKE) update-gmo 325 326 # General rule for creating PO files. 327 328 .nop.po-create: 329 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ 330 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ 331 exit 1 332 333 # General rule for updating PO files. 334 335 .nop.po-update: 336 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ 337 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ 338 tmpdir=`pwd`; \ 339 echo "$$lang:"; \ 340 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 341 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ 342 cd $(srcdir); \ 343 if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ 344 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 345 rm -f $$tmpdir/$$lang.new.po; \ 346 else \ 347 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 348 :; \ 349 else \ 350 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 351 exit 1; \ 352 fi; \ 353 fi; \ 354 else \ 355 echo "msgmerge for $$lang.po failed!" 1>&2; \ 356 rm -f $$tmpdir/$$lang.new.po; \ 357 fi 358 359 $(DUMMYPOFILES): 360 361 update-gmo: Makefile $(GMOFILES) 362 @: 363 364 Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@ 365 cd $(top_builddir) \ 366 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ 367 $(SHELL) ./config.status 368 369 force: 370 371 # Tell versions [3.59,3.63) of GNU make not to export all variables. 372 # Otherwise a system limit (for SysV at least) may be exceeded. 373 .NOEXPORT: 374