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