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