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