Imported from ../bash-3.0.tar.gz.
[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           --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
109         $(MAKE) $(MFLAGS) builtins.pot-update
110         test ! -f $(DOMAIN).po || { \
111           if test -f $(srcdir)/$(DOMAIN).pot; then \
112             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
113             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
114             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
115               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
116             else \
117               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
118               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
119             fi; \
120           else \
121             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
122           fi; \
123         }
124
125 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
126 # every "make" invocation, only create it when it is missing.
127 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
128 $(srcdir)/$(DOMAIN).pot:
129         $(MAKE) $(DOMAIN).pot-update
130
131 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
132 # Note that a PO file is not touched if it doesn't need to be changed.
133 $(POFILES): $(srcdir)/$(DOMAIN).pot
134         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
135         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
136         echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
137         cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
138
139
140 install: install-exec install-data
141 install-exec:
142 install-data: install-data-@USE_NLS@
143         if test "$(PACKAGE)" = "gettext-tools"; then \
144           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
145           for file in $(DISTFILES.common) Makevars.template; do \
146             $(INSTALL_DATA) $(srcdir)/$$file \
147                             $(DESTDIR)$(gettextsrcdir)/$$file; \
148           done; \
149           for file in Makevars; do \
150             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
151           done; \
152         else \
153           : ; \
154         fi
155 install-data-no: all
156 install-data-yes: all
157         $(mkinstalldirs) $(DESTDIR)$(datadir)
158         @catalogs='$(CATALOGS)'; \
159         for cat in $$catalogs; do \
160           cat=`basename $$cat`; \
161           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
162           dir=$(localedir)/$$lang/LC_MESSAGES; \
163           $(mkinstalldirs) $(DESTDIR)$$dir; \
164           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
165           $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
166           echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
167           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
168             if test -n "$$lc"; then \
169               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
170                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
171                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
172                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
173                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
174                  for file in *; do \
175                    if test -f $$file; then \
176                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
177                    fi; \
178                  done); \
179                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
180               else \
181                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
182                   :; \
183                 else \
184                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
185                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
186                 fi; \
187               fi; \
188               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
189               ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
190               ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
191               cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
192               echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
193             fi; \
194           done; \
195         done
196
197 install-strip: install
198
199 installdirs: installdirs-exec installdirs-data
200 installdirs-exec:
201 installdirs-data: installdirs-data-@USE_NLS@
202         if test "$(PACKAGE)" = "gettext-tools"; then \
203           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
204         else \
205           : ; \
206         fi
207 installdirs-data-no:
208 installdirs-data-yes:
209         $(mkinstalldirs) $(DESTDIR)$(datadir)
210         @catalogs='$(CATALOGS)'; \
211         for cat in $$catalogs; do \
212           cat=`basename $$cat`; \
213           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
214           dir=$(localedir)/$$lang/LC_MESSAGES; \
215           $(mkinstalldirs) $(DESTDIR)$$dir; \
216           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
217             if test -n "$$lc"; then \
218               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
219                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
220                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
221                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
222                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
223                  for file in *; do \
224                    if test -f $$file; then \
225                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
226                    fi; \
227                  done); \
228                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
229               else \
230                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
231                   :; \
232                 else \
233                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
234                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
235                 fi; \
236               fi; \
237             fi; \
238           done; \
239         done
240
241 # Define this as empty until I found a useful application.
242 installcheck:
243
244 uninstall: uninstall-exec uninstall-data
245 uninstall-exec:
246 uninstall-data: uninstall-data-@USE_NLS@
247         if test "$(PACKAGE)" = "gettext-tools"; then \
248           for file in $(DISTFILES.common) Makevars.template; do \
249             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
250           done; \
251         else \
252           : ; \
253         fi
254 uninstall-data-no:
255 uninstall-data-yes:
256         catalogs='$(CATALOGS)'; \
257         for cat in $$catalogs; do \
258           cat=`basename $$cat`; \
259           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
260           for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
261             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
262           done; \
263         done
264
265 check: all
266
267 info dvi ps pdf html tags TAGS ctags CTAGS ID:
268
269 mostlyclean:
270         rm -f remove-potcdate.sed
271         rm -f stamp-poT
272         rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
273         rm -fr *.o
274
275 clean: mostlyclean
276
277 distclean: clean
278         rm -f Makefile Makefile.in POTFILES *.mo
279
280 maintainer-clean: distclean
281         @echo "This command is intended for maintainers to use;"
282         @echo "it deletes files that may require special tools to rebuild."
283         rm -f stamp-po $(GMOFILES)
284
285 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
286 dist distdir:
287         $(MAKE) update-po
288         @$(MAKE) dist2
289 # This is a separate target because 'update-po' must be executed before.
290 dist2: $(DISTFILES)
291         dists="$(DISTFILES)"; \
292         if test "$(PACKAGE)" = "gettext-tools"; then \
293           dists="$$dists Makevars.template"; \
294         fi; \
295         if test -f $(srcdir)/ChangeLog; then \
296           dists="$$dists ChangeLog"; \
297         fi; \
298         for i in 0 1 2 3 4 5 6 7 8 9; do \
299           if test -f $(srcdir)/ChangeLog.$$i; then \
300             dists="$$dists ChangeLog.$$i"; \
301           fi; \
302         done; \
303         if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
304         for file in $$dists; do \
305           if test -f $$file; then \
306             cp -p $$file $(distdir); \
307           else \
308             cp -p $(srcdir)/$$file $(distdir); \
309           fi; \
310         done
311
312 update-po: Makefile
313         $(MAKE) $(DOMAIN).pot-update
314         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
315         $(MAKE) update-gmo
316
317 # General rule for updating PO files.
318
319 .nop.po-update:
320         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
321         if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
322         tmpdir=`pwd`; \
323         echo "$$lang:"; \
324         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
325         echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
326         cd $(srcdir); \
327         if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
328           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
329             rm -f $$tmpdir/$$lang.new.po; \
330           else \
331             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
332               :; \
333             else \
334               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
335               exit 1; \
336             fi; \
337           fi; \
338         else \
339           echo "msgmerge for $$lang.po failed!" 1>&2; \
340           rm -f $$tmpdir/$$lang.new.po; \
341         fi
342
343 $(DUMMYPOFILES):
344
345 update-gmo: Makefile $(GMOFILES)
346         @:
347
348 Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@ $(srcdir)/Rules-builtins
349         cd $(top_builddir) \
350           && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
351                $(SHELL) ./config.status
352
353 force:
354
355 # Tell versions [3.59,3.63) of GNU make not to export all variables.
356 # Otherwise a system limit (for SysV at least) may be exceeded.
357 .NOEXPORT: