blob: aae32e797fdf65a41c692333a8893ada53b5f274 [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001# 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 = libelf
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@
36XGETTEXT_OPTIONS = --flag=error:3:c-format
37MSGMERGE = msgmerge
38MSGMERGE_UPDATE = @MSGMERGE@ --update
39MSGINIT = msginit
40MSGCONV = msgconv
41MSGFILTER = msgfilter
42
43POFILES = @POFILES@
44GMOFILES = @GMOFILES@
45UPDATEPOFILES = @UPDATEPOFILES@
46DUMMYPOFILES = @DUMMYPOFILES@
47DISTFILES.common = Makefile.in.in Makevars \
48$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
49DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
50$(POFILES) $(GMOFILES) \
51$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
52
53POTFILES = \
54
55CATALOGS = @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
72all: all-@USE_NLS@
73
74all-yes: $(CATALOGS)
75all-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
100install: install-exec install-data
101install-exec:
102install-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
112install-data-no: all
113install-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
154install-strip: install
155
156installdirs: installdirs-exec installdirs-data
157installdirs-exec:
158installdirs-data: installdirs-data-@USE_NLS@
159 if test "$(PACKAGE)" = "gettext"; then \
160 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
161 else \
162 : ; \
163 fi
164installdirs-data-no:
165installdirs-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.
199installcheck:
200
201uninstall: uninstall-exec uninstall-data
202uninstall-exec:
203uninstall-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
211uninstall-data-no:
212uninstall-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
222check: all
223
224dvi info tags TAGS ID:
225
226mostlyclean:
227 rm -f core core.* $(DOMAIN).po *.new.po
228 rm -fr *.o
229
230clean: mostlyclean
231
232distclean: clean
233 rm -f Makefile Makefile.in POTFILES *.mo
234
235maintainer-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
240distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
241dist distdir:
242 $(MAKE) update-po
243 @$(MAKE) dist2
244# This is a separate target because 'update-po' must be executed before.
245dist2: $(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
257update-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
290update-gmo: Makefile $(GMOFILES)
291 @:
292
293Makefile: 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
298force:
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: