1 # Makefile for PO directory in any package using GNU gettext. 2 # Copyright (C) 1995-1997, 2000-2002 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 PACKAGE = libelf 12 VERSION = 0.97 13 14 SHELL = /bin/sh 15 16 17 srcdir = . 18 top_srcdir = .. 19 20 21 prefix = /work/elfutils/google/linux-install-elfutils-0.97/ 22 exec_prefix = ${prefix} 23 datadir = ${prefix}/share 24 localedir = $(datadir)/locale 25 gettextsrcdir = $(datadir)/gettext/po 26 top_builddir = .. 27 28 INSTALL = /usr/bin/install -c 29 INSTALL_DATA = ${INSTALL} -m 644 30 MKINSTALLDIRS = config/mkinstalldirs 31 mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` 32 33 GMSGFMT = /usr/bin/msgfmt 34 MSGFMT = /usr/bin/msgfmt 35 XGETTEXT = /usr/bin/xgettext 36 MSGMERGE = msgmerge 37 MSGMERGE_UPDATE = /usr/bin/msgmerge --update 38 MSGINIT = msginit 39 MSGCONV = msgconv 40 MSGFILTER = msgfilter 41 42 POFILES = @POFILES@ 43 GMOFILES = @GMOFILES@ 44 UPDATEPOFILES = @UPDATEPOFILES@ 45 DUMMYPOFILES = @DUMMYPOFILES@ 46 DISTFILES.common = Makefile.in.in Makevars \ 47 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) 48 DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \ 49 $(POFILES) $(GMOFILES) \ 50 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) 51 52 POTFILES = \ 53 54 CATALOGS = @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 71 all: all-yes 72 73 all-yes: $(CATALOGS) 74 all-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 99 install: install-exec install-data 100 install-exec: 101 install-data: install-data-yes 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 111 install-data-no: all 112 install-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 153 install-strip: install 154 155 installdirs: installdirs-exec installdirs-data 156 installdirs-exec: 157 installdirs-data: installdirs-data-yes 158 if test "$(PACKAGE)" = "gettext"; then \ 159 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ 160 else \ 161 : ; \ 162 fi 163 installdirs-data-no: 164 installdirs-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. 198 installcheck: 199 200 uninstall: uninstall-exec uninstall-data 201 uninstall-exec: 202 uninstall-data: uninstall-data-yes 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 210 uninstall-data-no: 211 uninstall-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 221 check: all 222 223 dvi info tags TAGS ID: 224 225 mostlyclean: 226 rm -f core core.* $(DOMAIN).po *.new.po 227 rm -fr *.o 228 229 clean: mostlyclean 230 231 distclean: clean 232 rm -f Makefile Makefile.in POTFILES *.mo 233 234 maintainer-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 239 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) 240 dist distdir: 241 $(MAKE) update-po 242 @$(MAKE) dist2 243 # This is a separate target because 'update-po' must be executed before. 244 dist2: $(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 256 update-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 289 update-gmo: Makefile $(GMOFILES) 290 @: 291 292 Makefile: 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 297 force: 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