1# Makefile for PO directory in any package using GNU gettext. 2# Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <drepper@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 11PACKAGE = @PACKAGE@ 12VERSION = @VERSION@ 13 14SHELL = /bin/sh 15@SET_MAKE@ 16 17srcdir = @srcdir@ 18top_srcdir = @top_srcdir@ 19VPATH = @srcdir@ 20 21prefix = @prefix@ 22exec_prefix = @exec_prefix@ 23datadir = @datadir@ 24localedir = $(datadir)/locale 25gettextsrcdir = $(datadir)/gettext/po 26top_builddir = .. 27 28INSTALL = @INSTALL@ 29INSTALL_DATA = @INSTALL_DATA@ 30MKINSTALLDIRS = @MKINSTALLDIRS@ 31mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` 32 33GMSGFMT = @GMSGFMT@ 34MSGFMT = @MSGFMT@ 35XGETTEXT = @XGETTEXT@ 36MSGMERGE = msgmerge 37MSGMERGE_UPDATE = @MSGMERGE@ --update 38MSGINIT = msginit 39MSGCONV = msgconv 40MSGFILTER = msgfilter 41 42POFILES = @POFILES@ 43GMOFILES = @GMOFILES@ 44UPDATEPOFILES = @UPDATEPOFILES@ 45DUMMYPOFILES = @DUMMYPOFILES@ 46DISTFILES.common = Makefile.in.in Makevars \ 47$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) 48DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \ 49$(POFILES) $(GMOFILES) \ 50$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) 51 52POTFILES = \ 53 54CATALOGS = @CATALOGS@ 55 56# Makevars gets inserted here. (Don't remove this line!) 57 58.SUFFIXES: 59.SUFFIXES: .po .gmo .mo .nop .po-update 60 61.po.mo: 62 $(MSGFMT) -c -o $@ $< 63 64.po.gmo: 65 @lang=`echo $* | sed -e 's,.*/,,'`; \ 66 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 67 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ 68 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po 69 70 71all: all-@USE_NLS@ 72 73all-yes: $(CATALOGS) 74all-no: 75 76# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', 77# otherwise packages like GCC can not be built if only parts of the source 78# have been downloaded. 79 80$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in 81 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ 82 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ 83 --files-from=$(srcdir)/POTFILES.in \ 84 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 85 && test ! -f $(DOMAIN).po \ 86 || ( rm -f $(srcdir)/$(DOMAIN).pot \ 87 && mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot ) 88 89$(srcdir)/$(DOMAIN).pot: 90 $(MAKE) $(DOMAIN).pot-update 91 92$(POFILES): $(srcdir)/$(DOMAIN).pot 93 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ 94 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 95 echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ 96 cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot 97 98 99install: install-exec install-data 100install-exec: 101install-data: install-data-@USE_NLS@ 102 if test "$(PACKAGE)" = "gettext"; then \ 103 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ 104 for file in $(DISTFILES.common); do \ 105 $(INSTALL_DATA) $(srcdir)/$$file \ 106 $(DESTDIR)$(gettextsrcdir)/$$file; \ 107 done; \ 108 else \ 109 : ; \ 110 fi 111install-data-no: all 112install-data-yes: all 113 $(mkinstalldirs) $(DESTDIR)$(datadir) 114 @catalogs='$(CATALOGS)'; \ 115 for cat in $$catalogs; do \ 116 cat=`basename $$cat`; \ 117 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 118 dir=$(localedir)/$$lang/LC_MESSAGES; \ 119 $(mkinstalldirs) $(DESTDIR)$$dir; \ 120 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ 121 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ 122 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ 123 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 124 if test -n "$$lc"; then \ 125 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 126 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 127 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 128 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 129 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 130 for file in *; do \ 131 if test -f $$file; then \ 132 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 133 fi; \ 134 done); \ 135 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 136 else \ 137 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 138 :; \ 139 else \ 140 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 141 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 142 fi; \ 143 fi; \ 144 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 145 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 146 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ 147 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 148 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ 149 fi; \ 150 done; \ 151 done 152 153install-strip: install 154 155installdirs: installdirs-exec installdirs-data 156installdirs-exec: 157installdirs-data: installdirs-data-@USE_NLS@ 158 if test "$(PACKAGE)" = "gettext"; then \ 159 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ 160 else \ 161 : ; \ 162 fi 163installdirs-data-no: 164installdirs-data-yes: 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 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ 173 if test -n "$$lc"; then \ 174 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ 175 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ 176 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 177 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 178 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ 179 for file in *; do \ 180 if test -f $$file; then \ 181 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ 182 fi; \ 183 done); \ 184 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ 185 else \ 186 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ 187 :; \ 188 else \ 189 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ 190 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ 191 fi; \ 192 fi; \ 193 fi; \ 194 done; \ 195 done 196 197# Define this as empty until I found a useful application. 198installcheck: 199 200uninstall: uninstall-exec uninstall-data 201uninstall-exec: 202uninstall-data: uninstall-data-@USE_NLS@ 203 if test "$(PACKAGE)" = "gettext"; then \ 204 for file in $(DISTFILES.common); do \ 205 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ 206 done; \ 207 else \ 208 : ; \ 209 fi 210uninstall-data-no: 211uninstall-data-yes: 212 catalogs='$(CATALOGS)'; \ 213 for cat in $$catalogs; do \ 214 cat=`basename $$cat`; \ 215 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ 216 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ 217 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ 218 done; \ 219 done 220 221check: all 222 223dvi info tags TAGS ID: 224 225mostlyclean: 226 rm -f core core.* $(DOMAIN).po *.new.po 227 rm -fr *.o 228 229clean: mostlyclean 230 231distclean: clean 232 rm -f Makefile Makefile.in POTFILES *.mo 233 234maintainer-clean: distclean 235 @echo "This command is intended for maintainers to use;" 236 @echo "it deletes files that may require special tools to rebuild." 237 rm -f $(GMOFILES) 238 239distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) 240dist distdir: 241 $(MAKE) update-po 242 @$(MAKE) dist2 243# This is a separate target because 'update-po' must be executed before. 244dist2: $(DISTFILES) 245 dists="$(DISTFILES)"; \ 246 if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \ 247 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ 248 for file in $$dists; do \ 249 if test -f $$file; then \ 250 cp -p $$file $(distdir); \ 251 else \ 252 cp -p $(srcdir)/$$file $(distdir); \ 253 fi; \ 254 done 255 256update-po: Makefile 257 $(MAKE) $(DOMAIN).pot-update 258 $(MAKE) $(UPDATEPOFILES) 259 $(MAKE) update-gmo 260 261# General rule for updating PO files. 262 263.nop.po-update: 264 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ 265 if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \ 266 tmpdir=`pwd`; \ 267 echo "$$lang:"; \ 268 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 269 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ 270 cd $(srcdir); \ 271 if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ 272 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 273 rm -f $$tmpdir/$$lang.new.po; \ 274 else \ 275 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 276 :; \ 277 else \ 278 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 279 exit 1; \ 280 fi; \ 281 fi; \ 282 else \ 283 echo "msgmerge for $$lang.po failed!" 1>&2; \ 284 rm -f $$tmpdir/$$lang.new.po; \ 285 fi 286 287$(DUMMYPOFILES): 288 289update-gmo: Makefile $(GMOFILES) 290 @: 291 292Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in 293 cd $(top_builddir) \ 294 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ 295 $(SHELL) ./config.status 296 297force: 298 299# Tell versions [3.59,3.63) of GNU make not to export all variables. 300# Otherwise a system limit (for SysV at least) may be exceeded. 301.NOEXPORT: 302