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