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