1
# Makefile for program source directory in GNU NLS utilities package.
2
# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
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 file be copied and used freely without restrictions. It can
5
# be used in projects which are not available under the GNU General Public License
6
# but which still want to provide support for the GNU gettext functionality.
7
# Please note that the actual code is *not* freely available.
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.
10
12
VERSION = @VERSION@
12
# These two variables depend on the location of this directory.
31
29
MKINSTALLDIRS = @MKINSTALLDIRS@
32
30
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
35
32
GMSGFMT = @GMSGFMT@
37
34
XGETTEXT = @XGETTEXT@
38
35
MSGMERGE = msgmerge
44
INCLUDES = -I.. -I$(top_srcdir)/intl
46
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
36
MSGMERGE_UPDATE = @MSGMERGE@ --update
48
41
POFILES = @POFILES@
49
42
GMOFILES = @GMOFILES@
50
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
51
$(POFILES) $(GMOFILES)
43
UPDATEPOFILES = @UPDATEPOFILES@
44
DUMMYPOFILES = @DUMMYPOFILES@
45
DISTFILES.common = Makefile.in.in Makevars remove-potcdate.sin \
46
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
47
DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
48
$(POFILES) $(GMOFILES) \
49
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
55
53
CATALOGS = @CATALOGS@
55
# Makevars gets inserted here. (Don't remove this line!)
58
.SUFFIXES: .c .o .po .pox .gmo .mo
64
$(MAKE) $(PACKAGE).pot
65
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
58
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
61
@echo "$(MSGFMT) -c -o $@ $<"; \
62
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
71
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
72
&& rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
65
@lang=`echo $* | sed -e 's,.*/,,'`; \
66
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
67
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
68
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
71
sed -e '/^#/d' $< > t-$@
77
77
all-yes: $(CATALOGS)
80
# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
80
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
81
81
# otherwise packages like GCC can not be built if only parts of the source
82
82
# have been downloaded.
84
$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
85
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
86
--add-comments --keyword=_ --keyword=N_ \
84
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
85
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
86
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
87
87
--files-from=$(srcdir)/POTFILES.in \
88
&& test ! -f $(PACKAGE).po \
89
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
90
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
88
--copyright-holder='$(COPYRIGHT_HOLDER)'
89
test ! -f $(DOMAIN).po || { \
90
if test -f $(srcdir)/$(DOMAIN).pot; then \
91
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
92
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
93
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
94
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
96
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
97
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
100
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
104
$(srcdir)/$(DOMAIN).pot:
105
$(MAKE) $(DOMAIN).pot-update
107
$(POFILES): $(srcdir)/$(DOMAIN).pot
108
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
109
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
110
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
111
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
93
114
install: install-exec install-data
106
129
@catalogs='$(CATALOGS)'; \
107
130
for cat in $$catalogs; do \
108
131
cat=`basename $$cat`; \
109
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
110
dir=$(localedir)/$$lang/LC_MESSAGES; \
111
$(mkinstalldirs) $(DESTDIR)$$dir; \
112
if test -r $$cat; then \
113
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
114
echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
116
$(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
117
echo "installing $(srcdir)/$$cat as" \
118
"$(DESTDIR)$$dir/$(PACKAGE).mo"; \
132
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
133
dir=$(localedir)/$$lang/LC_MESSAGES; \
134
$(mkinstalldirs) $(DESTDIR)$$dir; \
135
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
136
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
137
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
138
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
139
if test -n "$$lc"; then \
140
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
141
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
142
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
143
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
144
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
146
if test -f $$file; then \
147
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
150
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
152
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
155
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
156
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
159
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
160
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
161
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
162
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
163
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
168
install-strip: install
170
installdirs: installdirs-exec installdirs-data
172
installdirs-data: installdirs-data-@USE_NLS@
173
if test "$(PACKAGE)" = "gettext"; then \
174
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
179
installdirs-data-yes:
180
$(mkinstalldirs) $(DESTDIR)$(datadir)
181
@catalogs='$(CATALOGS)'; \
182
for cat in $$catalogs; do \
183
cat=`basename $$cat`; \
184
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
185
dir=$(localedir)/$$lang/LC_MESSAGES; \
186
$(mkinstalldirs) $(DESTDIR)$$dir; \
187
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
188
if test -n "$$lc"; then \
189
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
190
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
191
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
192
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
193
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
195
if test -f $$file; then \
196
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
199
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
201
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
204
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
205
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
122
212
# Define this as empty until I found a useful application.
215
uninstall: uninstall-exec uninstall-data
217
uninstall-data: uninstall-data-@USE_NLS@
218
if test "$(PACKAGE)" = "gettext"; then \
219
for file in $(DISTFILES.common); do \
220
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
126
227
catalogs='$(CATALOGS)'; \
127
228
for cat in $$catalogs; do \
128
229
cat=`basename $$cat`; \
129
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
130
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
230
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
231
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
232
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
132
if test "$(PACKAGE)" = "gettext"; then \
133
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
140
238
dvi info tags TAGS ID:
143
rm -f core core.* *.pox $(PACKAGE).po *.new.po
241
rm -f remove-potcdate.sed
242
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
146
245
clean: mostlyclean
160
259
# This is a separate target because 'update-po' must be executed before.
161
260
dist2: $(DISTFILES)
162
261
dists="$(DISTFILES)"; \
262
if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
263
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
163
264
for file in $$dists; do \
164
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
165
cp -p $$dir/$$file $(distdir); \
265
if test -f $$file; then \
266
cp -p $$file $(distdir); \
268
cp -p $(srcdir)/$$file $(distdir); \
168
272
update-po: Makefile
169
$(MAKE) $(PACKAGE).pot
273
$(MAKE) $(DOMAIN).pot-update
274
$(MAKE) $(UPDATEPOFILES)
277
# General rule for updating PO files.
280
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
170
281
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
284
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
285
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
172
catalogs='$(GMOFILES)'; \
173
for cat in $$catalogs; do \
174
cat=`basename $$cat`; \
175
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
177
if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
178
mv -f $$lang.new.po $$lang.po; \
287
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
288
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
289
rm -f $$tmpdir/$$lang.new.po; \
180
echo "msgmerge for $$cat failed!"; \
181
rm -f $$lang.new.po; \
291
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
294
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
299
echo "msgmerge for $$lang.po failed!" 1>&2; \
300
rm -f $$tmpdir/$$lang.new.po; \
186
305
update-gmo: Makefile $(GMOFILES)