OSDN Git Service

Use Linux-kernel-style makefile output to make it easier to
[android-x86/external-e2fsprogs.git] / po / Makefile.in.in
1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2002 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@
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@
23 datadir = @datadir@
24 localedir = $(datadir)/locale
25 gettextsrcdir = $(datadir)/gettext/po
26
27 INSTALL = @INSTALL@
28 INSTALL_DATA = @INSTALL_DATA@
29 MKINSTALLDIRS = @MKINSTALLDIRS@
30 mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
31
32 GMSGFMT = @GMSGFMT@
33 MSGFMT = @MSGFMT@
34 XGETTEXT = @XGETTEXT@
35 MSGMERGE = msgmerge
36 MSGMERGE_UPDATE = @MSGMERGE@ --update
37 MSGINIT = msginit
38 MSGCONV = msgconv
39 MSGFILTER = msgfilter
40
41 POFILES = @POFILES@
42 GMOFILES = @GMOFILES@
43 UPDATEPOFILES = @UPDATEPOFILES@
44 DUMMYPOFILES = @DUMMYPOFILES@
45 DISTFILES.common = Makefile.in.in Makevars remove-potcdate.sin \
46 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
47 DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
48 $(POFILES) $(GMOFILES) \
49 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
50
51 POTFILES = \
52
53 CATALOGS = @CATALOGS@
54
55 # Makevars gets inserted here. (Don't remove this line!)
56
57 .SUFFIXES:
58 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
59
60 .po.mo:
61         @echo "$(MSGFMT) -c -o $@ $<"; \
62         $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
63
64 .po.gmo:
65         @lang=`echo $* | sed -e 's,.*/,,'`; \
66         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
67         echo "  MSGFMT $${lang}.po"; \
68         $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $(srcdir)/$${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
69
70 .sin.sed:
71         sed -e '/^#/d' $< > t-$@
72         mv t-$@ $@
73
74
75 all: all-@USE_NLS@
76
77 all-yes: $(CATALOGS)
78 all-no:
79
80 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
81 # otherwise packages like GCC can not be built if only parts of the source
82 # have been downloaded.
83
84 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
85         $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
86           --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
87           --keyword=_ --keyword=N_ --keyword=P_:1,2 \
88           --files-from=$(srcdir)/POTFILES.in \
89           --copyright-holder='$(COPYRIGHT_HOLDER)'
90         test ! -f $(DOMAIN).po || { \
91           if test -f $(srcdir)/$(DOMAIN).pot; then \
92             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
93             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
94             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
95               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
96             else \
97               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
98               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
99             fi; \
100           else \
101             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
102           fi; \
103         }
104
105 $(srcdir)/$(DOMAIN).pot:
106         $(MAKE) $(DOMAIN).pot-update
107
108 $(POFILES): $(srcdir)/$(DOMAIN).pot
109         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
110         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
111         echo "  MSGMERGE $${lang}.po"; \
112         cd $(srcdir) && $(MSGMERGE_UPDATE) -q $${lang}.po $(DOMAIN).pot
113
114
115 install: install-exec install-data
116 install-exec:
117 install-data: install-data-@USE_NLS@
118         if test "$(PACKAGE)" = "gettext"; then \
119           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
120           for file in $(DISTFILES.common); do \
121             $(INSTALL_DATA) $(srcdir)/$$file \
122                             $(DESTDIR)$(gettextsrcdir)/$$file; \
123           done; \
124         else \
125           : ; \
126         fi
127 install-data-no: all
128 install-data-yes: all
129         $(mkinstalldirs) $(DESTDIR)$(datadir)
130         @catalogs='$(CATALOGS)'; \
131         for cat in $$catalogs; do \
132           cat=`basename $$cat`; \
133           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
134           dir=$(localedir)/$$lang/LC_MESSAGES; \
135           $(mkinstalldirs) $(DESTDIR)$$dir; \
136           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
137           $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
138           echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
139           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
140             if test -n "$$lc"; then \
141               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
142                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
143                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
144                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
145                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
146                  for file in *; do \
147                    if test -f $$file; then \
148                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
149                    fi; \
150                  done); \
151                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
152               else \
153                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
154                   :; \
155                 else \
156                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
157                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
158                 fi; \
159               fi; \
160               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
161               ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
162               ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
163               cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
164               echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
165             fi; \
166           done; \
167         done
168
169 install-strip: install
170
171 installdirs: installdirs-exec installdirs-data
172 installdirs-exec:
173 installdirs-data: installdirs-data-@USE_NLS@
174         if test "$(PACKAGE)" = "gettext"; then \
175           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
176         else \
177           : ; \
178         fi
179 installdirs-data-no:
180 installdirs-data-yes:
181         $(mkinstalldirs) $(DESTDIR)$(datadir)
182         @catalogs='$(CATALOGS)'; \
183         for cat in $$catalogs; do \
184           cat=`basename $$cat`; \
185           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
186           dir=$(localedir)/$$lang/LC_MESSAGES; \
187           $(mkinstalldirs) $(DESTDIR)$$dir; \
188           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
189             if test -n "$$lc"; then \
190               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
191                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
192                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
193                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
194                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
195                  for file in *; do \
196                    if test -f $$file; then \
197                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
198                    fi; \
199                  done); \
200                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
201               else \
202                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
203                   :; \
204                 else \
205                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
206                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
207                 fi; \
208               fi; \
209             fi; \
210           done; \
211         done
212
213 # Define this as empty until I found a useful application.
214 installcheck:
215
216 uninstall: uninstall-exec uninstall-data
217 uninstall-exec:
218 uninstall-data: uninstall-data-@USE_NLS@
219         if test "$(PACKAGE)" = "gettext"; then \
220           for file in $(DISTFILES.common); do \
221             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
222           done; \
223         else \
224           : ; \
225         fi
226 uninstall-data-no:
227 uninstall-data-yes:
228         catalogs='$(CATALOGS)'; \
229         for cat in $$catalogs; do \
230           cat=`basename $$cat`; \
231           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
232           for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
233             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
234           done; \
235         done
236
237 check: all
238
239 dvi info tags TAGS ID:
240
241 mostlyclean:
242         rm -f remove-potcdate.sed *.gmo
243         rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
244         rm -fr *.o
245
246 clean: mostlyclean
247
248 distclean: clean
249         rm -f Makefile Makefile.in POTFILES *.mo
250
251 maintainer-clean: distclean
252         @echo "This command is intended for maintainers to use;"
253         @echo "it deletes files that may require special tools to rebuild."
254         rm -f $(GMOFILES)
255
256 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
257 dist distdir:
258         $(MAKE) update-po
259         @$(MAKE) dist2
260 # This is a separate target because 'update-po' must be executed before.
261 dist2: $(DISTFILES)
262         dists="$(DISTFILES)"; \
263         if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
264         if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
265         for file in $$dists; do \
266           if test -f $$file; then \
267             cp -p $$file $(distdir); \
268           else \
269             cp -p $(srcdir)/$$file $(distdir); \
270           fi; \
271         done
272
273 update-po: Makefile
274         $(MAKE) $(DOMAIN).pot-update
275         $(MAKE) $(UPDATEPOFILES)
276         $(MAKE) update-gmo
277
278 # General rule for updating PO files.
279
280 .nop.po-update:
281         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
282         if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
283         tmpdir=`pwd`; \
284         echo "$$lang:"; \
285         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
286         echo "  MSGMERGE $$lang.po"; \
287         cd $(srcdir); \
288         if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
289           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
290             rm -f $$tmpdir/$$lang.new.po; \
291           else \
292             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
293               :; \
294             else \
295               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
296               exit 1; \
297             fi; \
298           fi; \
299         else \
300           echo "msgmerge for $$lang.po failed!" 1>&2; \
301           rm -f $$tmpdir/$$lang.new.po; \
302         fi
303
304 $(DUMMYPOFILES):
305
306 update-gmo: Makefile $(GMOFILES)
307         @:
308
309 Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
310         cd $(top_builddir) \
311           && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
312                $(SHELL) ./config.status
313
314 force:
315
316 # Tell versions [3.59,3.63) of GNU make not to export all variables.
317 # Otherwise a system limit (for SysV at least) may be exceeded.
318 .NOEXPORT: