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>
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
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.
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/
14 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
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 =
28 top_srcdir = @top_srcdir@
29 top_builddir = @top_builddir@
30 distdir = ../$(PACKAGE)-$(VERSION)/po
35 exec_prefix = @exec_prefix@
37 localedir = $(datadir)/locale
38 gettextsrcdir = $(datadir)/gettext/po
41 INSTALL_DATA = @INSTALL_DATA@
42 MKINSTALLDIRS = $(top_builddir)/@MKINSTALLDIRS@
43 mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
49 MSGMERGE_UPDATE = $(MSGMERGE) --update
56 #UPDATEPOFILES = @UPDATEPOFILES@
58 #DUMMYPOFILES = @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)
71 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
74 @echo "$(MSGFMT) -c -o $@ $<"; \
75 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
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
84 sed -e '/^#/d' $< > t-$@
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
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
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.
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)'
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; \
131 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
132 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
135 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
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
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
154 install: install-exec install-data
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; \
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 && \
186 if test -f $$file; then \
187 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
190 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
192 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
195 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
196 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
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"; \
208 install-strip: install
210 installdirs: installdirs-exec installdirs-data
212 installdirs-data: installdirs-data-@USE_NLS@
213 if test "$(GETTEXT_PACKAGE)" = "gettext-tools"; then \
214 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
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 && \
235 if test -f $$file; then \
236 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
239 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
241 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
244 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
245 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
252 # Define this as empty until I found a useful application.
255 uninstall: uninstall-exec uninstall-data
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; \
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; \
278 info dvi ps pdf html tags TAGS ctags CTAGS ID:
281 rm -f remove-potcdate.sed
283 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
289 rm -f Makefile Makefile.in POTFILES *.mo
290 rm -f stamp-po $(GMOFILES)
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."
299 # This is a separate target because 'update-po' must be executed before.
301 dists="$(DISTFILES)"; \
302 if test "$(GETTEXT_PACKAGE)" = "gettext-tools"; then \
305 if test -f $(srcdir)/ChangeLog; then \
306 dists="$$dists ChangeLog"; \
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"; \
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); \
318 cp -p $(srcdir)/$$file $(distdir); \
323 $(MAKE) $(DOMAIN).pot-update
324 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
327 # General rule for updating PO files.
330 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
331 if test "$(GETTEXT_PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
334 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
335 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
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; \
341 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
344 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
349 echo "msgmerge for $$lang.po failed!" 1>&2; \
350 rm -f $$tmpdir/$$lang.new.po; \
355 update-gmo: Makefile $(GMOFILES)
358 Makefile: Makefile.in.in $(top_builddir)/config.status
360 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
361 $(SHELL) ./config.status
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.