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>
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.
14
# thomas: add GETTEXT_PACKAGE substitution as used in Makevars
15
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
21
top_srcdir = @top_srcdir@
25
exec_prefix = @exec_prefix@
27
localedir = $(datadir)/locale
28
gettextsrcdir = $(datadir)/gettext/po
31
INSTALL_DATA = @INSTALL_DATA@
32
MKINSTALLDIRS = @MKINSTALLDIRS@
33
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
39
MSGMERGE_UPDATE = @MSGMERGE@ --update
46
UPDATEPOFILES = @UPDATEPOFILES@
47
DUMMYPOFILES = @DUMMYPOFILES@
48
DISTFILES.common = Makefile.in.in Makevars remove-potcdate.sin \
49
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
50
DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
51
$(POFILES) $(GMOFILES) \
52
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
58
# Makevars gets inserted here. (Don't remove this line!)
61
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
64
@echo "$(MSGFMT) -c -o $@ $<"; \
65
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
68
@lang=`echo $* | sed -e 's,.*/,,'`; \
69
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
70
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
71
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
74
sed -e '/^#/d' $< > t-$@
83
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
84
# otherwise packages like GCC can not be built if only parts of the source
85
# have been downloaded.
87
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
88
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
89
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
90
--files-from=$(srcdir)/POTFILES.in \
91
--copyright-holder='$(COPYRIGHT_HOLDER)'
92
test ! -f $(DOMAIN).po || { \
93
if test -f $(srcdir)/$(DOMAIN).pot; then \
94
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
95
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
96
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
97
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
99
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
100
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
103
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
107
$(srcdir)/$(DOMAIN).pot:
108
$(MAKE) $(DOMAIN).pot-update
110
$(POFILES): $(srcdir)/$(DOMAIN).pot
111
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
112
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
113
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
114
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
117
install: install-exec install-data
119
install-data: install-data-@USE_NLS@
120
if test "$(PACKAGE)" = "gettext"; then \
121
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
122
for file in $(DISTFILES.common); do \
123
$(INSTALL_DATA) $(srcdir)/$$file \
124
$(DESTDIR)$(gettextsrcdir)/$$file; \
130
install-data-yes: all
131
$(mkinstalldirs) $(DESTDIR)$(datadir)
132
@catalogs='$(CATALOGS)'; \
133
for cat in $$catalogs; do \
134
cat=`basename $$cat`; \
135
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
136
dir=$(localedir)/$$lang/LC_MESSAGES; \
137
$(mkinstalldirs) $(DESTDIR)$$dir; \
138
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
139
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
140
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
141
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
142
if test -n "$$lc"; then \
143
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
144
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
145
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
146
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
147
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
149
if test -f $$file; then \
150
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
153
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
155
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
158
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
159
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
162
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
163
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
164
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
165
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
166
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
171
install-strip: install
173
installdirs: installdirs-exec installdirs-data
175
installdirs-data: installdirs-data-@USE_NLS@
176
if test "$(PACKAGE)" = "gettext"; then \
177
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
182
installdirs-data-yes:
183
$(mkinstalldirs) $(DESTDIR)$(datadir)
184
@catalogs='$(CATALOGS)'; \
185
for cat in $$catalogs; do \
186
cat=`basename $$cat`; \
187
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
188
dir=$(localedir)/$$lang/LC_MESSAGES; \
189
$(mkinstalldirs) $(DESTDIR)$$dir; \
190
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
191
if test -n "$$lc"; then \
192
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
193
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
194
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
195
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
196
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
198
if test -f $$file; then \
199
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
202
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
204
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
207
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
208
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
215
# Define this as empty until I found a useful application.
218
uninstall: uninstall-exec uninstall-data
220
uninstall-data: uninstall-data-@USE_NLS@
221
if test "$(PACKAGE)" = "gettext"; then \
222
for file in $(DISTFILES.common); do \
223
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
230
catalogs='$(CATALOGS)'; \
231
for cat in $$catalogs; do \
232
cat=`basename $$cat`; \
233
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
234
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
235
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
241
dvi info tags TAGS ID:
244
rm -f remove-potcdate.sed
245
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
251
rm -f Makefile Makefile.in POTFILES *.mo
253
maintainer-clean: distclean
254
@echo "This command is intended for maintainers to use;"
255
@echo "it deletes files that may require special tools to rebuild."
258
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
262
# This is a separate target because 'update-po' must be executed before.
264
dists="$(DISTFILES)"; \
265
if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
266
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
267
for file in $$dists; do \
268
if test -f $$file; then \
269
cp -p $$file $(distdir); \
271
cp -p $(srcdir)/$$file $(distdir); \
276
$(MAKE) $(DOMAIN).pot-update
277
$(MAKE) $(UPDATEPOFILES)
280
# General rule for updating PO files.
283
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
284
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
287
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
288
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
290
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
291
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
292
rm -f $$tmpdir/$$lang.new.po; \
294
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
297
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
302
echo "msgmerge for $$lang.po failed!" 1>&2; \
303
rm -f $$tmpdir/$$lang.new.po; \
308
update-gmo: Makefile $(GMOFILES)
311
# thomas: add LINGUAS as a dependency so that the Makefile gets rebuilt
312
# properly when we add languages
313
Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in LINGUAS
315
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
316
$(SHELL) ./config.status
320
# Tell versions [3.59,3.63) of GNU make not to export all variables.
321
# Otherwise a system limit (for SysV at least) may be exceeded.