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