Update to upstream util-linux 2.20.1
[framework/base/util-linux-ng.git] / po / Makefile.in.in
1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2004 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 # Origin: gettext-0.14
12
13 PACKAGE = @PACKAGE@
14 VERSION = @VERSION@
15
16 SHELL = /bin/sh
17 @SET_MAKE@
18
19 srcdir = @srcdir@
20 top_srcdir = @top_srcdir@
21 VPATH = @srcdir@
22
23 prefix = @prefix@
24 exec_prefix = @exec_prefix@
25 datarootdir = @datarootdir@
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-create .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 "$(GMOFILES)" || $(MAKE) $(GMOFILES)
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         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         if test -f "$(srcdir)/$${lang}.po"; then \
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         else \
139           $(MAKE) $${lang}.po-create; \
140         fi
141
142
143 install: install-exec install-data
144 install-exec:
145 install-data: install-data-@USE_NLS@
146         if test "$(PACKAGE)" = "gettext-tools"; then \
147           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
148           for file in $(DISTFILES.common) Makevars.template; do \
149             $(INSTALL_DATA) $(srcdir)/$$file \
150                             $(DESTDIR)$(gettextsrcdir)/$$file; \
151           done; \
152           for file in Makevars; do \
153             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
154           done; \
155         else \
156           : ; \
157         fi
158 install-data-no: all
159 install-data-yes: all
160         $(mkinstalldirs) $(DESTDIR)$(datadir)
161         @catalogs='$(CATALOGS)'; \
162         for cat in $$catalogs; do \
163           cat=`basename $$cat`; \
164           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
165           dir=$(localedir)/$$lang/LC_MESSAGES; \
166           $(mkinstalldirs) $(DESTDIR)$$dir; \
167           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
168           $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
169           echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
170           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
171             if test -n "$$lc"; then \
172               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
173                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
174                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
175                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
176                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
177                  for file in *; do \
178                    if test -f $$file; then \
179                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
180                    fi; \
181                  done); \
182                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
183               else \
184                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
185                   :; \
186                 else \
187                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
188                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
189                 fi; \
190               fi; \
191               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
192               ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
193               ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
194               cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
195               echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
196             fi; \
197           done; \
198         done
199
200 install-strip: install
201
202 installdirs: installdirs-exec installdirs-data
203 installdirs-exec:
204 installdirs-data: installdirs-data-@USE_NLS@
205         if test "$(PACKAGE)" = "gettext-tools"; then \
206           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
207         else \
208           : ; \
209         fi
210 installdirs-data-no:
211 installdirs-data-yes:
212         $(mkinstalldirs) $(DESTDIR)$(datadir)
213         @catalogs='$(CATALOGS)'; \
214         for cat in $$catalogs; do \
215           cat=`basename $$cat`; \
216           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
217           dir=$(localedir)/$$lang/LC_MESSAGES; \
218           $(mkinstalldirs) $(DESTDIR)$$dir; \
219           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
220             if test -n "$$lc"; then \
221               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
222                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
223                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
224                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
225                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
226                  for file in *; do \
227                    if test -f $$file; then \
228                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
229                    fi; \
230                  done); \
231                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
232               else \
233                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
234                   :; \
235                 else \
236                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
237                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
238                 fi; \
239               fi; \
240             fi; \
241           done; \
242         done
243
244 # Define this as empty until I found a useful application.
245 installcheck:
246
247 uninstall: uninstall-exec uninstall-data
248 uninstall-exec:
249 uninstall-data: uninstall-data-@USE_NLS@
250         if test "$(PACKAGE)" = "gettext-tools"; then \
251           for file in $(DISTFILES.common) Makevars.template; do \
252             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
253           done; \
254         else \
255           : ; \
256         fi
257 uninstall-data-no:
258 uninstall-data-yes:
259         catalogs='$(CATALOGS)'; \
260         for cat in $$catalogs; do \
261           cat=`basename $$cat`; \
262           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
263           for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
264             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
265           done; \
266         done
267
268 check: all
269
270 info dvi ps pdf html tags TAGS ctags CTAGS ID:
271
272 mostlyclean:
273         rm -f remove-potcdate.sed
274         rm -f stamp-poT
275         rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
276         rm -fr *.o
277
278 clean: mostlyclean
279
280 distclean: clean
281         rm -f Makefile Makefile.in POTFILES *.mo
282
283 maintainer-clean: distclean
284         @echo "This command is intended for maintainers to use;"
285         @echo "it deletes files that may require special tools to rebuild."
286         rm -f stamp-po $(GMOFILES)
287
288 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
289 dist distdir:
290         $(MAKE) update-po
291         @$(MAKE) dist2
292 # This is a separate target because 'update-po' must be executed before.
293 dist2: $(DISTFILES)
294         dists="$(DISTFILES)"; \
295         if test "$(PACKAGE)" = "gettext-tools"; then \
296           dists="$$dists Makevars.template"; \
297         fi; \
298         if test -f $(srcdir)/ChangeLog; then \
299           dists="$$dists ChangeLog"; \
300         fi; \
301         for i in 0 1 2 3 4 5 6 7 8 9; do \
302           if test -f $(srcdir)/ChangeLog.$$i; then \
303             dists="$$dists ChangeLog.$$i"; \
304           fi; \
305         done; \
306         if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
307         for file in $$dists; do \
308           if test -f $$file; then \
309             cp -p $$file $(distdir); \
310           else \
311             cp -p $(srcdir)/$$file $(distdir); \
312           fi; \
313         done
314
315 update-po: Makefile
316         $(MAKE) $(DOMAIN).pot-update
317         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
318         $(MAKE) update-gmo
319
320 # General rule for creating PO files.
321
322 .nop.po-create:
323         @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
324         echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
325         exit 1
326
327 # General rule for updating PO files.
328
329 .nop.po-update:
330         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
331         if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
332         tmpdir=`pwd`; \
333         echo "$$lang:"; \
334         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
335         echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
336         cd $(srcdir); \
337         if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
338           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
339             rm -f $$tmpdir/$$lang.new.po; \
340           else \
341             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
342               :; \
343             else \
344               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
345               exit 1; \
346             fi; \
347           fi; \
348         else \
349           echo "msgmerge for $$lang.po failed!" 1>&2; \
350           rm -f $$tmpdir/$$lang.new.po; \
351         fi
352
353 $(DUMMYPOFILES):
354
355 update-gmo: Makefile $(GMOFILES)
356         @:
357
358 Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@
359         cd $(top_builddir) \
360           && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
361                $(SHELL) ./config.status
362
363 force:
364
365 # Tell versions [3.59,3.63) of GNU make not to export all variables.
366 # Otherwise a system limit (for SysV at least) may be exceeded.
367 .NOEXPORT: