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