]>
Commit | Line | Data |
---|---|---|
b80f6443 JA |
1 | # Makefile for PO directory in any package using GNU gettext. |
2 | # Copyright (C) 1995-1997, 2000-2003 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 = @PACKAGE_NAME@ | |
12 | VERSION = @PACKAGE_VERSION@ | |
13 | ||
14 | SHELL = /bin/sh | |
15 | @SET_MAKE@ | |
16 | ||
17 | srcdir = @srcdir@ | |
18 | top_srcdir = @top_srcdir@ | |
19 | VPATH = @srcdir@ | |
20 | ||
21 | topdir = @top_srcdir@ | |
22 | BUILD_DIR = @BUILD_DIR@ | |
23 | ||
24 | prefix = @prefix@ | |
25 | exec_prefix = @exec_prefix@ | |
3185942a JA |
26 | |
27 | datarootdir = @datarootdir@ | |
b80f6443 | 28 | datadir = @datadir@ |
3185942a JA |
29 | localedir = @localedir@ |
30 | ||
b80f6443 JA |
31 | gettextsrcdir = $(datadir)/gettext/po |
32 | ||
33 | INSTALL = @INSTALL@ | |
34 | INSTALL_DATA = @INSTALL_DATA@ | |
35 | MKINSTALLDIRS = @MKINSTALLDIRS@ | |
36 | mkinstalldirs = $(SHELL) $(MKINSTALLDIRS) | |
37 | ||
38 | GMSGFMT = @GMSGFMT@ | |
39 | MSGFMT = @MSGFMT@ | |
40 | XGETTEXT = @XGETTEXT@ | |
41 | MSGMERGE = msgmerge | |
42 | MSGMERGE_UPDATE = @MSGMERGE@ --update | |
43 | MSGINIT = msginit | |
44 | MSGCONV = msgconv | |
45 | MSGFILTER = msgfilter | |
46 | ||
47 | POFILES = @POFILES@ | |
48 | GMOFILES = @GMOFILES@ | |
49 | UPDATEPOFILES = @UPDATEPOFILES@ | |
50 | DUMMYPOFILES = @DUMMYPOFILES@ | |
51 | DISTFILES.common = Makefile.in.in remove-potcdate.sin \ | |
52 | $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) | |
53 | DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \ | |
54 | $(POFILES) $(GMOFILES) \ | |
55 | $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) | |
56 | ||
57 | POTFILES = \ | |
58 | ||
59 | CATALOGS = @CATALOGS@ | |
60 | ||
61 | # Makevars gets inserted here. (Don't remove this line!) | |
62 | ||
63 | .SUFFIXES: | |
64 | .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update | |
65 | ||
66 | .po.mo: | |
67 | @echo "$(MSGFMT) -c -o $@ $<"; \ | |
68 | $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ | |
69 | ||
70 | .po.gmo: | |
71 | @lang=`echo $* | sed -e 's,.*/,,'`; \ | |
72 | test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ | |
73 | echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ | |
74 | cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo | |
75 | ||
76 | .sin.sed: | |
77 | sed -e '/^#/d' $< > t-$@ | |
78 | mv t-$@ $@ | |
79 | ||
80 | ||
81 | all: all-@USE_NLS@ | |
82 | ||
83 | all-yes: stamp-po | |
84 | all-no: | |
85 | ||
86 | # stamp-po is a timestamp denoting the last time at which the CATALOGS have | |
87 | # been loosely updated. Its purpose is that when a developer or translator | |
88 | # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, | |
89 | # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent | |
90 | # invocations of "make" will do nothing. This timestamp would not be necessary | |
91 | # if updating the $(CATALOGS) would always touch them; however, the rule for | |
92 | # $(POFILES) has been designed to not touch files that don't need to be | |
93 | # changed. | |
94 | stamp-po: $(srcdir)/$(DOMAIN).pot | |
95 | test -z "$(CATALOGS)" || $(MAKE) $(CATALOGS) | |
96 | @echo "touch stamp-po" | |
97 | @echo timestamp > stamp-poT | |
98 | @mv stamp-poT stamp-po | |
99 | ||
100 | # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', | |
101 | # otherwise packages like GCC can not be built if only parts of the source | |
102 | # have been downloaded. | |
103 | ||
104 | # This target rebuilds $(DOMAIN).pot; it is an expensive operation. | |
105 | # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. | |
106 | $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed | |
107 | $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ | |
108 | --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ | |
109 | --files-from=$(srcdir)/POTFILES.in \ | |
95732b49 | 110 | --copyright-holder='$(COPYRIGHT_HOLDER)' |
b80f6443 JA |
111 | $(MAKE) $(MFLAGS) builtins.pot-update |
112 | test ! -f $(DOMAIN).po || { \ | |
113 | if test -f $(srcdir)/$(DOMAIN).pot; then \ | |
114 | sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ | |
115 | sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ | |
116 | if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ | |
117 | rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ | |
118 | else \ | |
119 | rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ | |
120 | mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ | |
121 | fi; \ | |
122 | else \ | |
123 | mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ | |
124 | fi; \ | |
125 | } | |
126 | ||
127 | # This rule has no dependencies: we don't need to update $(DOMAIN).pot at | |
128 | # every "make" invocation, only create it when it is missing. | |
129 | # Only "make $(DOMAIN).pot-update" or "make dist" will force an update. | |
130 | $(srcdir)/$(DOMAIN).pot: | |
131 | $(MAKE) $(DOMAIN).pot-update | |
132 | ||
133 | # This target rebuilds a PO file if $(DOMAIN).pot has changed. | |
134 | # Note that a PO file is not touched if it doesn't need to be changed. | |
135 | $(POFILES): $(srcdir)/$(DOMAIN).pot | |
136 | @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ | |
137 | test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ | |
138 | echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ | |
139 | cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot | |
140 | ||
141 | ||
142 | install: install-exec install-data | |
143 | install-exec: | |
144 | install-data: install-data-@USE_NLS@ | |
145 | if test "$(PACKAGE)" = "gettext-tools"; then \ | |
146 | $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ | |
147 | for file in $(DISTFILES.common) Makevars.template; do \ | |
148 | $(INSTALL_DATA) $(srcdir)/$$file \ | |
149 | $(DESTDIR)$(gettextsrcdir)/$$file; \ | |
150 | done; \ | |
151 | for file in Makevars; do \ | |
152 | rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ | |
153 | done; \ | |
154 | else \ | |
155 | : ; \ | |
156 | fi | |
157 | install-data-no: all | |
158 | install-data-yes: all | |
159 | $(mkinstalldirs) $(DESTDIR)$(datadir) | |
160 | @catalogs='$(CATALOGS)'; \ | |
161 | for cat in $$catalogs; do \ | |
162 | cat=`basename $$cat`; \ | |
163 | lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ | |
164 | dir=$(localedir)/$$lang/LC_MESSAGES; \ | |
165 | $(mkinstalldirs) $(DESTDIR)$$dir; \ | |
166 | if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ | |
167 | $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ | |
168 | echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ | |
169 | for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ | |
170 | if test -n "$$lc"; then \ | |
171 | if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ | |
172 | link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ | |
173 | mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ | |
174 | mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ | |
175 | (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ | |
176 | for file in *; do \ | |
177 | if test -f $$file; then \ | |
178 | ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ | |
179 | fi; \ | |
180 | done); \ | |
181 | rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ | |
182 | else \ | |
183 | if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ | |
184 | :; \ | |
185 | else \ | |
186 | rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ | |
187 | mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ | |
188 | fi; \ | |
189 | fi; \ | |
190 | rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ | |
191 | ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ | |
192 | ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ | |
193 | cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ | |
194 | echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ | |
195 | fi; \ | |
196 | done; \ | |
197 | done | |
198 | ||
199 | install-strip: install | |
200 | ||
201 | installdirs: installdirs-exec installdirs-data | |
202 | installdirs-exec: | |
203 | installdirs-data: installdirs-data-@USE_NLS@ | |
204 | if test "$(PACKAGE)" = "gettext-tools"; then \ | |
205 | $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ | |
206 | else \ | |
207 | : ; \ | |
208 | fi | |
209 | installdirs-data-no: | |
210 | installdirs-data-yes: | |
211 | $(mkinstalldirs) $(DESTDIR)$(datadir) | |
212 | @catalogs='$(CATALOGS)'; \ | |
213 | for cat in $$catalogs; do \ | |
214 | cat=`basename $$cat`; \ | |
215 | lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ | |
216 | dir=$(localedir)/$$lang/LC_MESSAGES; \ | |
217 | $(mkinstalldirs) $(DESTDIR)$$dir; \ | |
218 | for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ | |
219 | if test -n "$$lc"; then \ | |
220 | if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ | |
221 | link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ | |
222 | mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ | |
223 | mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ | |
224 | (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ | |
225 | for file in *; do \ | |
226 | if test -f $$file; then \ | |
227 | ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ | |
228 | fi; \ | |
229 | done); \ | |
230 | rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ | |
231 | else \ | |
232 | if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ | |
233 | :; \ | |
234 | else \ | |
235 | rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ | |
236 | mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ | |
237 | fi; \ | |
238 | fi; \ | |
239 | fi; \ | |
240 | done; \ | |
241 | done | |
242 | ||
243 | # Define this as empty until I found a useful application. | |
244 | installcheck: | |
245 | ||
246 | uninstall: uninstall-exec uninstall-data | |
247 | uninstall-exec: | |
248 | uninstall-data: uninstall-data-@USE_NLS@ | |
249 | if test "$(PACKAGE)" = "gettext-tools"; then \ | |
250 | for file in $(DISTFILES.common) Makevars.template; do \ | |
251 | rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ | |
252 | done; \ | |
253 | else \ | |
254 | : ; \ | |
255 | fi | |
256 | uninstall-data-no: | |
257 | uninstall-data-yes: | |
258 | catalogs='$(CATALOGS)'; \ | |
259 | for cat in $$catalogs; do \ | |
260 | cat=`basename $$cat`; \ | |
261 | lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ | |
262 | for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ | |
263 | rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ | |
264 | done; \ | |
265 | done | |
266 | ||
267 | check: all | |
268 | ||
269 | info dvi ps pdf html tags TAGS ctags CTAGS ID: | |
270 | ||
271 | mostlyclean: | |
272 | rm -f remove-potcdate.sed | |
273 | rm -f stamp-poT | |
274 | rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po | |
275 | rm -fr *.o | |
276 | ||
277 | clean: mostlyclean | |
278 | ||
279 | distclean: clean | |
280 | rm -f Makefile Makefile.in POTFILES *.mo | |
281 | ||
282 | maintainer-clean: distclean | |
283 | @echo "This command is intended for maintainers to use;" | |
284 | @echo "it deletes files that may require special tools to rebuild." | |
285 | rm -f stamp-po $(GMOFILES) | |
286 | ||
287 | distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) | |
288 | dist distdir: | |
289 | $(MAKE) update-po | |
290 | @$(MAKE) dist2 | |
291 | # This is a separate target because 'update-po' must be executed before. | |
292 | dist2: $(DISTFILES) | |
293 | dists="$(DISTFILES)"; \ | |
294 | if test "$(PACKAGE)" = "gettext-tools"; then \ | |
295 | dists="$$dists Makevars.template"; \ | |
296 | fi; \ | |
297 | if test -f $(srcdir)/ChangeLog; then \ | |
298 | dists="$$dists ChangeLog"; \ | |
299 | fi; \ | |
300 | for i in 0 1 2 3 4 5 6 7 8 9; do \ | |
301 | if test -f $(srcdir)/ChangeLog.$$i; then \ | |
302 | dists="$$dists ChangeLog.$$i"; \ | |
303 | fi; \ | |
304 | done; \ | |
305 | if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ | |
306 | for file in $$dists; do \ | |
307 | if test -f $$file; then \ | |
308 | cp -p $$file $(distdir); \ | |
309 | else \ | |
310 | cp -p $(srcdir)/$$file $(distdir); \ | |
311 | fi; \ | |
312 | done | |
313 | ||
314 | update-po: Makefile | |
315 | $(MAKE) $(DOMAIN).pot-update | |
316 | test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) | |
317 | $(MAKE) update-gmo | |
318 | ||
319 | # General rule for updating PO files. | |
320 | ||
321 | .nop.po-update: | |
322 | @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ | |
323 | if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ | |
324 | tmpdir=`pwd`; \ | |
325 | echo "$$lang:"; \ | |
326 | test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ | |
327 | echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ | |
328 | cd $(srcdir); \ | |
329 | if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ | |
330 | if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ | |
331 | rm -f $$tmpdir/$$lang.new.po; \ | |
332 | else \ | |
333 | if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ | |
334 | :; \ | |
335 | else \ | |
336 | echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ | |
337 | exit 1; \ | |
338 | fi; \ | |
339 | fi; \ | |
340 | else \ | |
341 | echo "msgmerge for $$lang.po failed!" 1>&2; \ | |
342 | rm -f $$tmpdir/$$lang.new.po; \ | |
343 | fi | |
344 | ||
345 | $(DUMMYPOFILES): | |
346 | ||
347 | update-gmo: Makefile $(GMOFILES) | |
348 | @: | |
349 | ||
350 | Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@ $(srcdir)/Rules-builtins | |
351 | cd $(top_builddir) \ | |
352 | && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ | |
353 | $(SHELL) ./config.status | |
354 | ||
355 | force: | |
356 | ||
357 | # Tell versions [3.59,3.63) of GNU make not to export all variables. | |
358 | # Otherwise a system limit (for SysV at least) may be exceeded. | |
359 | .NOEXPORT: |