1
1
# Makefile for PO directory in any package using GNU gettext.
2
# Copyright (C) 1995-2000 Ulrich Drepper <drepper@gnu.ai.mit.edu>
3
# Copyright (C) 2000-2020 Free Software Foundation, Inc.
5
# Copying and distribution of this file, with or without modification,
6
# are permitted in any medium without royalty provided the copyright
7
# notice and this notice are preserved. This file is offered as-is,
8
# without any warranty.
10
# Origin: gettext-0.20.2
11
GETTEXT_MACRO_VERSION = 0.20
2
# Copyright (C) 1995-1997, 2000-2007, 2009-2010 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
# Origin: gettext-0.18
12
GETTEXT_MACRO_VERSION = 0.18
13
14
PACKAGE = @PACKAGE@
14
15
VERSION = @VERSION@
15
16
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
44
44
MKDIR_P = @MKDIR_P@
45
45
mkdir_p = @mkdir_p@
47
# When building gettext-tools, we prefer to use the built programs
48
# rather than installed programs. However, we can't do that when we
49
# are cross compiling.
50
CROSS_COMPILING = @CROSS_COMPILING@
52
47
GMSGFMT_ = @GMSGFMT@
53
48
GMSGFMT_no = @GMSGFMT@
54
49
GMSGFMT_yes = @GMSGFMT_015@
55
50
GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
53
MSGFMT_yes = @MSGFMT_015@
54
MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
56
55
XGETTEXT_ = @XGETTEXT@
57
56
XGETTEXT_no = @XGETTEXT@
58
57
XGETTEXT_yes = @XGETTEXT_015@
59
58
XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
61
60
MSGMERGE_UPDATE = @MSGMERGE@ --update
62
MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@
65
63
MSGFILTER = msgfilter
79
77
CATALOGS = @CATALOGS@
81
POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot
82
POFILESDEPS_yes = $(POFILESDEPS_)
84
POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT))
86
DISTFILESDEPS_ = update-po
87
DISTFILESDEPS_yes = $(DISTFILESDEPS_)
89
DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
91
79
# Makevars gets inserted here. (Don't remove this line!)
97
.SUFFIXES: .po .gmo .sed .sin .nop .po-create .po-update
99
# The .pot file, stamp-po, .po files, and .gmo files appear in release tarballs.
100
# The GNU Coding Standards say in
101
# <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>:
102
# "GNU distributions usually contain some files which are not source files
103
# ... . Since these files normally appear in the source directory, they
104
# should always appear in the source directory, not in the build directory.
105
# So Makefile rules to update them should put the updated files in the
107
# Therefore we put these files in the source directory, not the build directory.
109
# During .po -> .gmo conversion, take into account the most recent changes to
110
# the .pot file. This eliminates the need to update the .po files when the
111
# .pot file has changed, which would be troublesome if the .po files are put
112
# under version control.
113
$(GMOFILES): $(srcdir)/$(DOMAIN).pot
82
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
85
@echo "$(MSGFMT) -c -o $@ $<"; \
86
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
115
89
@lang=`echo $* | sed -e 's,.*/,,'`; \
116
90
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
117
echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.1po && rm -f $${lang}.1po"; \
119
rm -f $${lang}.gmo && \
120
$(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && \
121
$(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.1po && \
122
mv t-$${lang}.gmo $${lang}.gmo && \
91
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
92
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
126
95
sed -e '/^#/d' $< > t-$@
130
all-yes: $(srcdir)/stamp-po
99
all: check-macro-version all-@USE_NLS@
133
104
# Ensure that the gettext macros and this Makefile.in.in are in sync.
134
CHECK_MACRO_VERSION = \
135
test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
106
@test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
136
107
|| { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \
141
112
# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
142
113
# we don't want to bother translators with empty POT files). We assume that
143
114
# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
144
# In this case, $(srcdir)/stamp-po is a nop (i.e. a phony target).
115
# In this case, stamp-po is a nop (i.e. a phony target).
146
# $(srcdir)/stamp-po is a timestamp denoting the last time at which the CATALOGS
147
# have been loosely updated. Its purpose is that when a developer or translator
148
# checks out the package from a version control system, and the $(DOMAIN).pot
149
# file is not under version control, "make" will update the $(DOMAIN).pot and
150
# the $(CATALOGS), but subsequent invocations of "make" will do nothing. This
151
# timestamp would not be necessary if updating the $(CATALOGS) would always
152
# touch them; however, the rule for $(POFILES) has been designed to not touch
153
# files that don't need to be changed.
154
$(srcdir)/stamp-po: $(srcdir)/$(DOMAIN).pot
155
@$(CHECK_MACRO_VERSION)
117
# stamp-po is a timestamp denoting the last time at which the CATALOGS have
118
# been loosely updated. Its purpose is that when a developer or translator
119
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
120
# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
121
# invocations of "make" will do nothing. This timestamp would not be necessary
122
# if updating the $(CATALOGS) would always touch them; however, the rule for
123
# $(POFILES) has been designed to not touch files that don't need to be
125
stamp-po: $(srcdir)/$(DOMAIN).pot
156
126
test ! -f $(srcdir)/$(DOMAIN).pot || \
157
127
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
158
128
@test ! -f $(srcdir)/$(DOMAIN).pot || { \
159
echo "touch $(srcdir)/stamp-po" && \
160
echo timestamp > $(srcdir)/stamp-poT && \
161
mv $(srcdir)/stamp-poT $(srcdir)/stamp-po; \
129
echo "touch stamp-po" && \
130
echo timestamp > stamp-poT && \
131
mv stamp-poT stamp-po; \
164
134
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
168
138
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
169
139
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
170
# The determination of whether the package xyz is a GNU one is based on the
171
# heuristic whether some file in the top level directory mentions "GNU xyz".
172
# If GNU 'find' is available, we avoid grepping through monster files.
173
140
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
174
package_gnu="$(PACKAGE_GNU)"; \
175
test -n "$$package_gnu" || { \
176
if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
177
LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep -i 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
179
LC_ALL=C grep -i 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
181
} | grep -v 'libtool:' >/dev/null; then \
187
if test "$$package_gnu" = "yes"; then \
188
package_prefix='GNU '; \
141
if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
142
package_gnu='GNU '; \
192
146
if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
193
147
msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
197
151
case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
198
152
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
199
153
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
200
--add-comments=TRANSLATORS: \
154
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
201
155
--files-from=$(srcdir)/POTFILES.in \
202
156
--copyright-holder='$(COPYRIGHT_HOLDER)' \
203
157
--msgid-bugs-address="$$msgid_bugs_address" \
204
$(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
207
160
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
208
--add-comments=TRANSLATORS: \
161
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
209
162
--files-from=$(srcdir)/POTFILES.in \
210
163
--copyright-holder='$(COPYRIGHT_HOLDER)' \
211
--package-name="$${package_prefix}@PACKAGE@" \
164
--package-name="$${package_gnu}@PACKAGE@" \
212
165
--package-version='@VERSION@' \
213
166
--msgid-bugs-address="$$msgid_bugs_address" \
214
$(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
217
169
test ! -f $(DOMAIN).po || { \
218
if test -f $(srcdir)/$(DOMAIN).pot-header; then \
219
sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \
220
cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po && \
221
rm -f $(DOMAIN).1po \
224
170
if test -f $(srcdir)/$(DOMAIN).pot; then \
225
171
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
226
172
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
244
190
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
245
191
# Note that a PO file is not touched if it doesn't need to be changed.
246
$(POFILES): $(POFILESDEPS)
247
@test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot
192
$(POFILES): $(srcdir)/$(DOMAIN).pot
248
193
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
249
194
if test -f "$(srcdir)/$${lang}.po"; then \
250
195
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
251
echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot"; \
196
echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
253
198
&& { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
254
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
199
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
255
200
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
256
0.1[6-7] | 0.1[6-7].*) \
257
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --previous $${lang}.po $(DOMAIN).pot;; \
259
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot;; \
202
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
392
335
info dvi ps pdf html tags TAGS ctags CTAGS ID:
394
install-dvi install-ps install-pdf install-html:
397
338
rm -f remove-potcdate.sed
398
rm -f $(srcdir)/stamp-poT
399
340
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
402
343
clean: mostlyclean
405
rm -f Makefile Makefile.in POTFILES
346
rm -f Makefile Makefile.in POTFILES *.mo
407
348
maintainer-clean: distclean
408
349
@echo "This command is intended for maintainers to use;"
409
350
@echo "it deletes files that may require special tools to rebuild."
410
rm -f $(srcdir)/$(DOMAIN).pot $(srcdir)/stamp-po $(GMOFILES)
351
rm -f stamp-po $(GMOFILES)
412
353
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
414
test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
416
357
# This is a separate target because 'update-po' must be executed before.
417
dist2: $(srcdir)/stamp-po $(DISTFILES)
358
dist2: stamp-po $(DISTFILES)
418
359
dists="$(DISTFILES)"; \
419
360
if test "$(PACKAGE)" = "gettext-tools"; then \
420
361
dists="$$dists Makevars.template"; \
457
398
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
458
if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \
399
if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
460
401
echo "$$lang:"; \
461
402
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
462
echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
403
echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
464
405
if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
465
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
406
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
466
407
$(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
467
0.1[6-7] | 0.1[6-7].*) \
468
$(MSGMERGE) $(MSGMERGE_OPTIONS) --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
470
$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
409
$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
473
412
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \