1
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>
2
# Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
4
4
# This file can be copied and used freely without restrictions. It can
5
5
# be used in projects which are not available under the GNU General Public
27
29
INSTALL = @INSTALL@
28
30
INSTALL_DATA = @INSTALL_DATA@
29
31
MKINSTALLDIRS = @MKINSTALLDIRS@
30
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
32
mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
32
34
GMSGFMT = @GMSGFMT@
42
44
GMOFILES = @GMOFILES@
43
45
UPDATEPOFILES = @UPDATEPOFILES@
44
46
DUMMYPOFILES = @DUMMYPOFILES@
45
DISTFILES.common = Makefile.in.in Makevars remove-potcdate.sin \
47
DISTFILES.common = Makefile.in.in remove-potcdate.sin \
46
48
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
47
DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
49
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \
48
50
$(POFILES) $(GMOFILES) \
49
51
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
65
67
@lang=`echo $* | sed -e 's,.*/,,'`; \
66
68
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
67
69
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
68
$(GMSGFMT) -c --statistics -o t-$${lang}.gmo $(srcdir)/$${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
70
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
71
73
sed -e '/^#/d' $< > t-$@
79
all-yes: @MAINTAINER_CMT@stamp-po
82
# stamp-po is a timestamp denoting the last time at which the CATALOGS have
83
# been loosely updated. Its purpose is that when a developer or translator
84
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
85
# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
86
# invocations of "make" will do nothing. This timestamp would not be necessary
87
# if updating the $(CATALOGS) would always touch them; however, the rule for
88
# $(POFILES) has been designed to not touch files that don't need to be
90
stamp-po: $(srcdir)/$(DOMAIN).pot
91
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
92
@echo "touch stamp-po"
93
@echo timestamp > stamp-poT
94
@mv stamp-poT stamp-po
80
96
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
81
97
# otherwise packages like GCC can not be built if only parts of the source
82
98
# have been downloaded.
84
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
100
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
101
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
102
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed \
103
$(srcdir)/at-expand.pl
85
104
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
86
105
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
87
--keyword=_ --keyword=N_ --keyword=P_:1,2 \
88
106
--files-from=$(srcdir)/POTFILES.in \
89
--copyright-holder='$(COPYRIGHT_HOLDER)'
107
--copyright-holder='$(COPYRIGHT_HOLDER)' \
108
--msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
109
perl $(srcdir)/at-expand.pl < $(DOMAIN).po > $(DOMAIN).po.new
110
mv $(DOMAIN).po $(DOMAIN).po.bak
111
mv $(DOMAIN).po.new $(DOMAIN).po
90
112
test ! -f $(DOMAIN).po || { \
91
113
if test -f $(srcdir)/$(DOMAIN).pot; then \
92
114
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
127
# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
128
# every "make" invocation, only create it when it is missing.
129
# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
105
130
$(srcdir)/$(DOMAIN).pot:
106
131
$(MAKE) $(DOMAIN).pot-update
133
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
134
# Note that a PO file is not touched if it doesn't need to be changed.
108
135
$(POFILES): $(srcdir)/$(DOMAIN).pot
109
136
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
110
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
111
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
112
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
137
if test -f "$(srcdir)/$${lang}.po"; then \
138
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
139
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
140
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
142
$(MAKE) $${lang}.po-create; \
115
146
install: install-exec install-data
117
148
install-data: install-data-@USE_NLS@
118
if test "$(PACKAGE)" = "gettext"; then \
149
if test "$(PACKAGE)" = "gettext-tools"; then \
119
150
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
120
for file in $(DISTFILES.common); do \
151
for file in $(DISTFILES.common) Makevars.template; do \
121
152
$(INSTALL_DATA) $(srcdir)/$$file \
122
153
$(DESTDIR)$(gettextsrcdir)/$$file; \
155
for file in Makevars; do \
156
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
171
205
installdirs: installdirs-exec installdirs-data
172
206
installdirs-exec:
173
207
installdirs-data: installdirs-data-@USE_NLS@
174
if test "$(PACKAGE)" = "gettext"; then \
208
if test "$(PACKAGE)" = "gettext-tools"; then \
175
209
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
216
250
uninstall: uninstall-exec uninstall-data
218
252
uninstall-data: uninstall-data-@USE_NLS@
219
if test "$(PACKAGE)" = "gettext"; then \
220
for file in $(DISTFILES.common); do \
253
if test "$(PACKAGE)" = "gettext-tools"; then \
254
for file in $(DISTFILES.common) Makevars.template; do \
221
255
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
251
287
maintainer-clean: distclean
252
288
@echo "This command is intended for maintainers to use;"
253
289
@echo "it deletes files that may require special tools to rebuild."
290
rm -f stamp-po $(GMOFILES)
256
292
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
260
296
# This is a separate target because 'update-po' must be executed before.
261
297
dist2: $(DISTFILES)
262
298
dists="$(DISTFILES)"; \
263
if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
299
if test "$(PACKAGE)" = "gettext-tools"; then \
300
dists="$$dists Makevars.template"; \
302
if test -f $(srcdir)/ChangeLog; then \
303
dists="$$dists ChangeLog"; \
305
for i in 0 1 2 3 4 5 6 7 8 9; do \
306
if test -f $(srcdir)/ChangeLog.$$i; then \
307
dists="$$dists ChangeLog.$$i"; \
264
310
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
265
311
for file in $$dists; do \
266
312
if test -f $$file; then \
273
319
update-po: Makefile
274
320
$(MAKE) $(DOMAIN).pot-update
275
$(MAKE) $(UPDATEPOFILES)
321
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
276
322
$(MAKE) update-gmo
324
# General rule for creating PO files.
327
@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
328
echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
278
331
# General rule for updating PO files.
281
334
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
282
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
335
if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
284
337
echo "$$lang:"; \
285
338
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
306
359
update-gmo: Makefile $(GMOFILES)
309
Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
362
Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@
310
363
cd $(top_builddir) \
311
364
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
312
365
$(SHELL) ./config.status