69ee24965b31ea60a3a39224b05407103c024a71
[platform/upstream/gstreamer.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 # - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
12 #   instead of PACKAGE and to look for po2tbl in ./ not in intl/
13
14 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
15 PACKAGE = @PACKAGE@
16 VERSION = @VERSION@
17
18 DOMAIN = $(GETTEXT_PACKAGE)
19 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
20 COPYRIGHT_HOLDER = GStreamer core team
21 MSGID_BUGS_ADDRESS = "http://bugzilla.gnome.org"
22 EXTRA_LOCALE_CATEGORIES =
23
24 SHELL = /bin/sh
25 @SET_MAKE@
26
27 srcdir = @srcdir@
28 top_srcdir = @top_srcdir@
29 top_builddir = @top_builddir@
30 distdir = ../$(PACKAGE)-$(VERSION)/po
31 subdir = po
32 VPATH = @srcdir@
33
34 prefix = @prefix@
35 exec_prefix = @exec_prefix@
36 datadir = @datadir@
37 localedir = $(datadir)/locale
38 gettextsrcdir = $(datadir)/gettext/po
39
40 INSTALL = @INSTALL@
41 INSTALL_DATA = @INSTALL_DATA@
42 MKINSTALLDIRS = $(top_builddir)/@MKINSTALLDIRS@
43 mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
44
45 GMSGFMT = @GMSGFMT@
46 MSGFMT = @MSGFMT@
47 XGETTEXT = @XGETTEXT@
48 MSGMERGE = msgmerge
49 MSGMERGE_UPDATE = $(MSGMERGE) --update
50 MSGINIT = msginit
51 MSGCONV = msgconv
52 MSGFILTER = msgfilter
53
54 POFILES = @POFILES@
55 GMOFILES = @GMOFILES@
56 #UPDATEPOFILES = @UPDATEPOFILES@
57 UPDATEPOFILES = 
58 #DUMMYPOFILES = @DUMMYPOFILES@
59 DUMMYPOFILES = 
60 DISTFILES.common = Makefile.in.in remove-potcdate.sin \
61 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
62 DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot stamp-po \
63 $(POFILES) $(GMOFILES) \
64 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
65
66 POTFILES = \
67
68 CATALOGS = @CATALOGS@
69
70 .SUFFIXES:
71 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
72
73 .po.mo:
74         @echo "$(MSGFMT) -c -o $@ $<"; \
75         $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
76
77 .po.gmo:
78         @lang=`echo $* | sed -e 's,.*/,,'`; \
79         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
80         echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
81         $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $(srcdir)/$${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
82
83 .sin.sed:
84         sed -e '/^#/d' $< > t-$@
85         mv t-$@ $@
86
87
88 all: all-@USE_NLS@
89
90 all-yes: stamp-po
91 all-no:
92
93 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
94 # been loosely updated. Its purpose is that when a developer or translator
95 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
96 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
97 # invocations of "make" will do nothing. This timestamp would not be necessary
98 # if updating the $(CATALOGS) would always touch them; however, the rule for
99 # $(POFILES) has been designed to not touch files that don't need to be
100 # changed.
101 stamp-po: $(srcdir)/$(DOMAIN).pot
102         test -z "$(CATALOGS)" || $(MAKE) $(CATALOGS)
103         @echo "touch stamp-po"
104         @echo timestamp > stamp-poT
105         @mv stamp-poT stamp-po
106
107 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
108 # otherwise packages like GCC can not be built if only parts of the source
109 # have been downloaded.
110
111 # thomasvs, 11/12/03: this option has been added in gettext 0.12
112 # if we really need this, then we should add a check for the version,
113 # but for now it doesn't seem to be worth the hassle, so I'm commenting
114 # this option to the gettext incantation below
115 #         --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
116
117 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
118 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
119 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
120         $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
121           --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
122           --files-from=$(srcdir)/POTFILES.in \
123           --copyright-holder='$(COPYRIGHT_HOLDER)' \
124         test ! -f $(DOMAIN).po || { \
125           if test -f $(srcdir)/$(DOMAIN).pot; then \
126             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
127             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
128             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
129               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
130             else \
131               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
132               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
133             fi; \
134           else \
135             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
136           fi; \
137         }
138
139 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
140 # every "make" invocation, only create it when it is missing.
141 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
142 $(srcdir)/$(DOMAIN).pot:
143         $(MAKE) $(DOMAIN).pot-update
144
145 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
146 # Note that a PO file is not touched if it doesn't need to be changed.
147 $(POFILES): $(srcdir)/$(DOMAIN).pot
148         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
149         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
150         echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
151         cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
152
153
154 install: install-exec install-data
155 install-exec:
156 install-data: install-data-@USE_NLS@
157         if test "$(GETTEXT_PACKAGE)" = "gettext-tools"; then \
158           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
159           for file in $(DISTFILES.common) ; do \
160             $(INSTALL_DATA) $(srcdir)/$$file \
161                             $(DESTDIR)$(gettextsrcdir)/$$file; \
162           done; \
163         else \
164           : ; \
165         fi
166 install-data-no: all
167 install-data-yes: all
168         $(mkinstalldirs) $(DESTDIR)$(datadir)
169         @catalogs='$(CATALOGS)'; \
170         for cat in $$catalogs; do \
171           cat=`basename $$cat`; \
172           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
173           dir=$(localedir)/$$lang/LC_MESSAGES; \
174           $(mkinstalldirs) $(DESTDIR)$$dir; \
175           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
176           $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
177           echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
178           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
179             if test -n "$$lc"; then \
180               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
181                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
182                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
183                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
184                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
185                  for file in *; do \
186                    if test -f $$file; then \
187                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
188                    fi; \
189                  done); \
190                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
191               else \
192                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
193                   :; \
194                 else \
195                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
196                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
197                 fi; \
198               fi; \
199               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
200               ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
201               ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
202               cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
203               echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
204             fi; \
205           done; \
206         done
207
208 install-strip: install
209
210 installdirs: installdirs-exec installdirs-data
211 installdirs-exec:
212 installdirs-data: installdirs-data-@USE_NLS@
213         if test "$(GETTEXT_PACKAGE)" = "gettext-tools"; then \
214           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
215         else \
216           : ; \
217         fi
218 installdirs-data-no:
219 installdirs-data-yes:
220         $(mkinstalldirs) $(DESTDIR)$(datadir)
221         @catalogs='$(CATALOGS)'; \
222         for cat in $$catalogs; do \
223           cat=`basename $$cat`; \
224           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
225           dir=$(localedir)/$$lang/LC_MESSAGES; \
226           $(mkinstalldirs) $(DESTDIR)$$dir; \
227           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
228             if test -n "$$lc"; then \
229               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
230                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
231                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
232                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
233                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
234                  for file in *; do \
235                    if test -f $$file; then \
236                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
237                    fi; \
238                  done); \
239                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
240               else \
241                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
242                   :; \
243                 else \
244                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
245                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
246                 fi; \
247               fi; \
248             fi; \
249           done; \
250         done
251
252 # Define this as empty until I found a useful application.
253 installcheck:
254
255 uninstall: uninstall-exec uninstall-data
256 uninstall-exec:
257 uninstall-data: uninstall-data-@USE_NLS@
258         if test "$(GETTEXT_PACKAGE)" = "gettext-tools"; then \
259           for file in $(DISTFILES.common) ; do \
260             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
261           done; \
262         else \
263           : ; \
264         fi
265 uninstall-data-no:
266 uninstall-data-yes:
267         catalogs='$(CATALOGS)'; \
268         for cat in $$catalogs; do \
269           cat=`basename $$cat`; \
270           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
271           for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
272             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
273           done; \
274         done
275
276 check: all
277
278 info dvi ps pdf html tags TAGS ctags CTAGS ID:
279
280 mostlyclean:
281         rm -f remove-potcdate.sed
282         rm -f stamp-poT
283         rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
284         rm -fr *.o
285
286 clean: mostlyclean
287
288 distclean: clean
289         rm -f Makefile Makefile.in POTFILES *.mo
290         rm -f stamp-po $(GMOFILES)
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
296 dist distdir:
297         $(MAKE) update-po
298         @$(MAKE) dist2
299 # This is a separate target because 'update-po' must be executed before.
300 dist2: $(DISTFILES)
301         dists="$(DISTFILES)"; \
302         if test "$(GETTEXT_PACKAGE)" = "gettext-tools"; then \
303           dists="$$dists "; \
304         fi; \
305         if test -f $(srcdir)/ChangeLog; then \
306           dists="$$dists ChangeLog"; \
307         fi; \
308         for i in 0 1 2 3 4 5 6 7 8 9; do \
309           if test -f $(srcdir)/ChangeLog.$$i; then \
310             dists="$$dists ChangeLog.$$i"; \
311           fi; \
312         done; \
313         if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
314         for file in $$dists; do \
315           if test -f $$file; then \
316             cp -p $$file $(distdir); \
317           else \
318             cp -p $(srcdir)/$$file $(distdir); \
319           fi; \
320         done
321
322 update-po: Makefile
323         $(MAKE) $(DOMAIN).pot-update
324         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
325         $(MAKE) update-gmo
326
327 # General rule for updating PO files.
328
329 .nop.po-update:
330         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
331         if test "$(GETTEXT_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
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: