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