1
1
# Makefile for program source directory in GNU NLS utilities package.
2
2
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3
# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com>
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 Public License
5
# This file may be copied and used freely without restrictions. It may
6
# be used in projects which are not available under a GNU Public License,
6
7
# but which still want to provide support for the GNU gettext functionality.
7
# Please note that the actual code is *not* freely available.
9
9
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
10
10
# instead of PACKAGE and to look for po2tbl in ./ not in intl/
12
12
# - Modified by jacob berkman <jacob@ximian.com> to install
13
13
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
15
# - Modified by Rodney Dawes <dobey.pwns@gmail.com> for use with intltool
17
# We have the following line for use by intltoolize:
15
20
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
16
21
PACKAGE = @PACKAGE@
17
22
VERSION = @VERSION@
23
27
top_srcdir = @top_srcdir@
28
top_builddir = @top_builddir@
27
32
exec_prefix = @exec_prefix@
28
33
datadir = @datadir@
34
datarootdir = @datarootdir@
30
localedir = $(libdir)/locale
31
gnulocaledir = $(datadir)/locale
32
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
36
DATADIRNAME = @DATADIRNAME@
37
itlocaledir = $(prefix)/$(DATADIRNAME)/locale
39
install_sh = @install_sh@
40
# Automake >= 1.8 provides @mkdir_p@.
41
# Until it can be supposed, use the safe fallback:
42
mkdir_p = $(install_sh) -d
35
44
INSTALL = @INSTALL@
36
45
INSTALL_DATA = @INSTALL_DATA@
37
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
41
47
GMSGFMT = @GMSGFMT@
43
49
XGETTEXT = @XGETTEXT@
50
INCLUDES = -I.. -I$(top_srcdir)/intl
52
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
57
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
58
$(POFILES) $(GMOFILES) $(SOURCES)
50
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
51
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
52
MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
53
GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
55
ALL_LINGUAS = @ALL_LINGUAS@
57
PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
59
USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi)
61
USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
63
POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
65
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES)
66
EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
69
# This comment gets stripped out
63
CATOBJEXT = @CATOBJEXT@
64
INSTOBJEXT = @INSTOBJEXT@
71
CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
67
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
74
.SUFFIXES: .po .pox .gmo .mo .msg .cat
73
77
$(MAKE) $(GETTEXT_PACKAGE).pot
74
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
78
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
80
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
81
&& rm -f $$file && $(GMSGFMT) -c -o $$file $<
84
file=`echo $* | sed 's,.*/,,'`.gmo \
85
&& rm -f $$file && $(GMSGFMT) -o $$file $<
84
88
sed -f ../intl/po2msg.sed < $< > $*.msg \
85
&& rm -f $@ && $(GENCAT) $@ $*.msg
89
&& rm -f $@ && gencat $@ $*.msg
90
94
all-yes: $(CATALOGS)
93
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
94
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
95
--add-comments --keyword=_ --keyword=N_ \
96
--flag=g_strdup_printf:1:c-format \
97
--flag=g_string_printf:2:c-format \
98
--flag=g_string_append_printf:2:c-format \
99
--flag=g_error_new:3:c-format \
100
--flag=g_set_error:4:c-format \
101
--flag=g_markup_printf_escaped:1:c-format \
102
--flag=g_log:3:c-format \
103
--flag=g_print:1:c-format \
104
--flag=g_printerr:1:c-format \
105
--flag=g_printf:1:c-format \
106
--flag=g_fprintf:2:c-format \
107
--flag=g_sprintf:2:c-format \
108
--flag=g_snprintf:3:c-format \
109
--flag=g_scanner_error:2:c-format \
110
--flag=g_scanner_warn:2:c-format \
111
--files-from=$(srcdir)/POTFILES.in \
112
&& test ! -f $(GETTEXT_PACKAGE).po \
113
|| ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
114
&& mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
97
$(GETTEXT_PACKAGE).pot: $(POTFILES)
116
install: install-exec install-data
100
install: install-data
118
101
install-data: install-data-@USE_NLS@
119
102
install-data-no: all
120
103
install-data-yes: all
121
if test -r "$(MKINSTALLDIRS)"; then \
122
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
124
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
126
@catalogs='$(CATALOGS)'; \
127
for cat in $$catalogs; do \
128
cat=`basename $$cat`; \
130
*.gmo) destdir=$(gnulocaledir);; \
131
*) destdir=$(localedir);; \
133
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
134
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
135
if test -r "$(MKINSTALLDIRS)"; then \
136
$(MKINSTALLDIRS) $$dir; \
138
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
140
if test -r $$cat; then \
141
$(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
142
echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
144
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
145
echo "installing $(srcdir)/$$cat as" \
146
"$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
148
if test -r $$cat.m; then \
149
$(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
150
echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
152
if test -r $(srcdir)/$$cat.m ; then \
153
$(INSTALL_DATA) $(srcdir)/$$cat.m \
154
$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
155
echo "installing $(srcdir)/$$cat as" \
156
"$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
104
$(mkdir_p) $(DESTDIR)$(itlocaledir)
105
linguas="$(USE_LINGUAS)"; \
106
for lang in $$linguas; do \
107
dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
109
if test -r $$lang.gmo; then \
110
$(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
111
echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
113
$(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
114
echo "installing $(srcdir)/$$lang.gmo as" \
115
"$$dir/$(GETTEXT_PACKAGE).mo"; \
117
if test -r $$lang.gmo.m; then \
118
$(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
119
echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
121
if test -r $(srcdir)/$$lang.gmo.m ; then \
122
$(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
123
$$dir/$(GETTEXT_PACKAGE).mo.m; \
124
echo "installing $(srcdir)/$$lang.gmo.m as" \
125
"$$dir/$(GETTEXT_PACKAGE).mo.m"; \
162
if test "$(PACKAGE)" = "glib"; then \
163
if test -r "$(MKINSTALLDIRS)"; then \
164
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
166
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
168
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
169
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
132
# Empty stubs to satisfy archaic automake needs
133
dvi info tags TAGS ID:
174
135
# Define this as empty until I found a useful application.
136
install-exec installcheck:
178
catalogs='$(CATALOGS)'; \
179
for cat in $$catalogs; do \
180
cat=`basename $$cat`; \
181
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
182
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
183
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
184
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
185
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
139
linguas="$(USE_LINGUAS)"; \
140
for lang in $$linguas; do \
141
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
142
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
187
if test "$(PACKAGE)" = "glib"; then \
188
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
145
check: all $(GETTEXT_PACKAGE).pot
146
rm -f missing notexist
147
srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
148
if [ -r missing -o -r notexist ]; then \
193
dvi info tags TAGS ID:
196
rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
153
rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
154
rm -f .intltool-merge-cache
199
156
clean: mostlyclean
202
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
159
rm -f Makefile Makefile.in POTFILES stamp-it
160
rm -f *.mo *.msg *.cat *.cat.m *.gmo
204
162
maintainer-clean: distclean
205
163
@echo "This command is intended for maintainers to use;"
206
164
@echo "it deletes files that may require special tools to rebuild."
209
distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
210
dist distdir: update-po $(DISTFILES)
167
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
168
dist distdir: $(DISTFILES)
211
169
dists="$(DISTFILES)"; \
170
extra_dists="$(EXTRA_DISTFILES)"; \
171
for file in $$extra_dists; do \
172
test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
212
174
for file in $$dists; do \
213
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
214
|| cp -p $(srcdir)/$$file $(distdir); \
175
test -f $$file || file="$(srcdir)/$$file"; \
176
ln $$file $(distdir) 2> /dev/null \
177
|| cp -p $$file $(distdir); \
217
180
update-po: Makefile
218
181
$(MAKE) $(GETTEXT_PACKAGE).pot
221
catalogs='$(CATALOGS)'; \
222
for cat in $$catalogs; do \
223
cat=`basename $$cat`; \
224
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
183
linguas="$(USE_LINGUAS)"; \
184
for lang in $$linguas; do \
225
185
echo "$$lang:"; \
226
if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
227
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
186
result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
188
if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
228
189
rm -f $$tmpdir/$$lang.new.po; \
230
191
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \