Home | History | Annotate | Download | only in libelf-po
      1 # Makefile for PO directory in any package using GNU gettext.
      2 # Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <drepper (at] 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 = 
     43 GMOFILES = 
     44 UPDATEPOFILES = 
     45 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      ../libelf/elf_error.c
     54 
     55 CATALOGS = 
     56 
     57 # Makevars gets inserted here. (Don't remove this line!)
     58 # Makefile variables for PO directory in any package using GNU gettext.
     59 
     60 # Usually the message domain is the same as the package name.
     61 DOMAIN = $(PACKAGE)
     62 
     63 # These two variables depend on the location of this directory.
     64 subdir = po
     65 top_builddir = ..
     66 
     67 # These options get passed to xgettext.
     68 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
     69 
     70 # This is the copyright holder that gets inserted into the header of the
     71 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
     72 # package.  (Note that the msgstr strings, extracted from the package's
     73 # sources, belong to the copyright holder of the package.)  Translators are
     74 # expected to transfer the copyright for their translations to this person
     75 # or entity, or to disclaim their copyright.  The empty string stands for
     76 # the public domain; in this case the translators are expected to disclaim
     77 # their copyright.
     78 COPYRIGHT_HOLDER = Red Hat, Inc.
     79 
     80 # This is the list of locale categories, beyond LC_MESSAGES, for which the
     81 # message catalogs shall be used.  It is usually empty.
     82 EXTRA_LOCALE_CATEGORIES =
     83 
     84 .SUFFIXES:
     85 .SUFFIXES: .po .gmo .mo .nop .po-update
     86 
     87 .po.mo:
     88 	$(MSGFMT) -c -o $@ $<
     89 
     90 .po.gmo:
     91 	@lang=`echo $* | sed -e 's,.*/,,'`; \
     92 	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
     93 	echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
     94 	cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po
     95 
     96 
     97 all: all-yes
     98 
     99 all-yes: $(CATALOGS)
    100 all-no:
    101 
    102 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
    103 # otherwise packages like GCC can not be built if only parts of the source
    104 # have been downloaded.
    105 
    106 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in
    107 	$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
    108 	  --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
    109 	  --files-from=$(srcdir)/POTFILES.in \
    110 	  --copyright-holder='$(COPYRIGHT_HOLDER)' \
    111 	&& test ! -f $(DOMAIN).po \
    112 	   || ( rm -f $(srcdir)/$(DOMAIN).pot \
    113 		&& mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot )
    114 
    115 $(srcdir)/$(DOMAIN).pot:
    116 	$(MAKE) $(DOMAIN).pot-update
    117 
    118 $(POFILES): $(srcdir)/$(DOMAIN).pot
    119 	@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
    120 	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
    121 	echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
    122 	cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
    123 
    124 
    125 install: install-exec install-data
    126 install-exec:
    127 install-data: install-data-yes
    128 	if test "$(PACKAGE)" = "gettext"; then \
    129 	  $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
    130 	  for file in $(DISTFILES.common); do \
    131 	    $(INSTALL_DATA) $(srcdir)/$$file \
    132 			    $(DESTDIR)$(gettextsrcdir)/$$file; \
    133 	  done; \
    134 	else \
    135 	  : ; \
    136 	fi
    137 install-data-no: all
    138 install-data-yes: all
    139 	$(mkinstalldirs) $(DESTDIR)$(datadir)
    140 	@catalogs='$(CATALOGS)'; \
    141 	for cat in $$catalogs; do \
    142 	  cat=`basename $$cat`; \
    143 	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
    144 	  dir=$(localedir)/$$lang/LC_MESSAGES; \
    145 	  $(mkinstalldirs) $(DESTDIR)$$dir; \
    146 	  if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
    147 	  $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
    148 	  echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
    149 	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
    150 	    if test -n "$$lc"; then \
    151 	      if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
    152 	        link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
    153 	        mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
    154 	        mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
    155 	        (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
    156 	         for file in *; do \
    157 	           if test -f $$file; then \
    158 	             ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
    159 	           fi; \
    160 	         done); \
    161 	        rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
    162 	      else \
    163 	        if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
    164 	          :; \
    165 	        else \
    166 	          rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
    167 	          mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
    168 	        fi; \
    169 	      fi; \
    170 	      rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
    171 	      ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
    172 	      ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
    173 	      cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
    174 	      echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
    175 	    fi; \
    176 	  done; \
    177 	done
    178 
    179 install-strip: install
    180 
    181 installdirs: installdirs-exec installdirs-data
    182 installdirs-exec:
    183 installdirs-data: installdirs-data-yes
    184 	if test "$(PACKAGE)" = "gettext"; then \
    185 	  $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
    186 	else \
    187 	  : ; \
    188 	fi
    189 installdirs-data-no:
    190 installdirs-data-yes:
    191 	$(mkinstalldirs) $(DESTDIR)$(datadir)
    192 	@catalogs='$(CATALOGS)'; \
    193 	for cat in $$catalogs; do \
    194 	  cat=`basename $$cat`; \
    195 	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
    196 	  dir=$(localedir)/$$lang/LC_MESSAGES; \
    197 	  $(mkinstalldirs) $(DESTDIR)$$dir; \
    198 	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
    199 	    if test -n "$$lc"; then \
    200 	      if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
    201 	        link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
    202 	        mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
    203 	        mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
    204 	        (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
    205 	         for file in *; do \
    206 	           if test -f $$file; then \
    207 	             ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
    208 	           fi; \
    209 	         done); \
    210 	        rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
    211 	      else \
    212 	        if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
    213 	          :; \
    214 	        else \
    215 	          rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
    216 	          mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
    217 	        fi; \
    218 	      fi; \
    219 	    fi; \
    220 	  done; \
    221 	done
    222 
    223 # Define this as empty until I found a useful application.
    224 installcheck:
    225 
    226 uninstall: uninstall-exec uninstall-data
    227 uninstall-exec:
    228 uninstall-data: uninstall-data-yes
    229 	if test "$(PACKAGE)" = "gettext"; then \
    230 	  for file in $(DISTFILES.common); do \
    231 	    rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
    232 	  done; \
    233 	else \
    234 	  : ; \
    235 	fi
    236 uninstall-data-no:
    237 uninstall-data-yes:
    238 	catalogs='$(CATALOGS)'; \
    239 	for cat in $$catalogs; do \
    240 	  cat=`basename $$cat`; \
    241 	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
    242 	  for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
    243 	    rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
    244 	  done; \
    245 	done
    246 
    247 check: all
    248 
    249 dvi info tags TAGS ID:
    250 
    251 mostlyclean:
    252 	rm -f core core.* $(DOMAIN).po *.new.po
    253 	rm -fr *.o
    254 
    255 clean: mostlyclean
    256 
    257 distclean: clean
    258 	rm -f Makefile Makefile.in POTFILES *.mo
    259 
    260 maintainer-clean: distclean
    261 	@echo "This command is intended for maintainers to use;"
    262 	@echo "it deletes files that may require special tools to rebuild."
    263 	rm -f $(GMOFILES)
    264 
    265 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
    266 dist distdir:
    267 	$(MAKE) update-po
    268 	@$(MAKE) dist2
    269 # This is a separate target because 'update-po' must be executed before.
    270 dist2: $(DISTFILES)
    271 	dists="$(DISTFILES)"; \
    272 	if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
    273 	if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
    274 	for file in $$dists; do \
    275 	  if test -f $$file; then \
    276 	    cp -p $$file $(distdir); \
    277 	  else \
    278 	    cp -p $(srcdir)/$$file $(distdir); \
    279 	  fi; \
    280 	done
    281 
    282 update-po: Makefile
    283 	$(MAKE) $(DOMAIN).pot-update
    284 	$(MAKE) $(UPDATEPOFILES)
    285 	$(MAKE) update-gmo
    286 
    287 # General rule for updating PO files.
    288 
    289 .nop.po-update:
    290 	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
    291 	if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
    292 	tmpdir=`pwd`; \
    293 	echo "$$lang:"; \
    294 	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
    295 	echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
    296 	cd $(srcdir); \
    297 	if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
    298 	  if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
    299 	    rm -f $$tmpdir/$$lang.new.po; \
    300 	  else \
    301 	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
    302 	      :; \
    303 	    else \
    304 	      echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
    305 	      exit 1; \
    306 	    fi; \
    307 	  fi; \
    308 	else \
    309 	  echo "msgmerge for $$lang.po failed!" 1>&2; \
    310 	  rm -f $$tmpdir/$$lang.new.po; \
    311 	fi
    312 
    313 $(DUMMYPOFILES):
    314 
    315 update-gmo: Makefile $(GMOFILES)
    316 	@:
    317 
    318 Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
    319 	cd $(top_builddir) \
    320 	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
    321 	       $(SHELL) ./config.status
    322 
    323 force:
    324 
    325 # Tell versions [3.59,3.63) of GNU make not to export all variables.
    326 # Otherwise a system limit (for SysV at least) may be exceeded.
    327 .NOEXPORT:
    328 # Special Makefile rules for English message catalogs with quotation marks.
    329 
    330 DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
    331 
    332 .SUFFIXES: .insert-header .po-update-en
    333 
    334 en@quot.po-update: en@quot.po-update-en
    335 en@boldquot.po-update: en@boldquot.po-update-en
    336 
    337 .insert-header.po-update-en:
    338 	@lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
    339 	if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
    340 	tmpdir=`pwd`; \
    341 	echo "$$lang:"; \
    342 	ll=`echo $$lang | sed -e 's/@.*//'`; \
    343 	LC_ALL=C; export LC_ALL; \
    344 	cd $(srcdir); \
    345 	if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
    346 	  if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
    347 	    rm -f $$tmpdir/$$lang.new.po; \
    348 	  else \
    349 	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
    350 	      :; \
    351 	    else \
    352 	      echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
    353 	      exit 1; \
    354 	    fi; \
    355 	  fi; \
    356 	else \
    357 	  echo "creation of $$lang.po failed!" 1>&2; \
    358 	  rm -f $$tmpdir/$$lang.new.po; \
    359 	fi
    360 
    361 en@quot.insert-header: insert-header.sin
    362 	sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
    363 
    364 en@boldquot.insert-header: insert-header.sin
    365 	sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
    366 
    367 mostlyclean: mostlyclean-quot
    368 mostlyclean-quot:
    369 	rm -f *.insert-header
    370