Commit | Line | Data |
---|---|---|
ef79bbde P |
1 | # Makefile for program source directory in GNU NLS utilities package. |
2 | # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu> | |
3 | # | |
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 | |
6 | # but which still want to provide support for the GNU gettext functionality. | |
7 | # Please note that the actual code is *not* freely available. | |
8 | # | |
9 | # - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE | |
10 | # instead of PACKAGE and to look for po2tbl in ./ not in intl/ | |
11 | # | |
12 | # - Modified by jacob berkman <jacob@ximian.com> to install | |
13 | # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize | |
14 | ||
15 | GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ | |
16 | PACKAGE = @PACKAGE@ | |
17 | VERSION = @VERSION@ | |
18 | ||
19 | SHELL = /bin/sh | |
20 | @SET_MAKE@ | |
21 | ||
22 | srcdir = @srcdir@ | |
23 | top_srcdir = @top_srcdir@ | |
24 | VPATH = @srcdir@ | |
25 | ||
26 | prefix = @prefix@ | |
27 | exec_prefix = @exec_prefix@ | |
28 | datadir = @datadir@ | |
29 | datarootdir = @datarootdir@ | |
30 | libdir = @libdir@ | |
31 | localedir = $(libdir)/locale | |
32 | gnulocaledir = $(datadir)/locale | |
33 | gettextsrcdir = $(datadir)/glib-2.0/gettext/po | |
34 | subdir = po | |
35 | ||
36 | INSTALL = @INSTALL@ | |
37 | INSTALL_DATA = @INSTALL_DATA@ | |
38 | MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ | |
39 | ||
40 | CC = @CC@ | |
41 | GENCAT = @GENCAT@ | |
42 | GMSGFMT = @GMSGFMT@ | |
43 | MSGFMT = @MSGFMT@ | |
44 | XGETTEXT = @XGETTEXT@ | |
45 | MSGMERGE = msgmerge | |
46 | ||
47 | DEFS = @DEFS@ | |
48 | CFLAGS = @CFLAGS@ | |
49 | CPPFLAGS = @CPPFLAGS@ | |
50 | ||
51 | INCLUDES = -I.. -I$(top_srcdir)/intl | |
52 | ||
53 | COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) | |
54 | ||
55 | SOURCES = | |
56 | POFILES = @POFILES@ | |
57 | GMOFILES = @GMOFILES@ | |
58 | DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ | |
59 | $(POFILES) $(GMOFILES) $(SOURCES) | |
60 | ||
61 | POTFILES = \ | |
62 | ||
63 | CATALOGS = @CATALOGS@ | |
64 | #CATOBJEXT = @CATOBJEXT@ | |
65 | #INSTOBJEXT = @INSTOBJEXT@ | |
66 | CATOBJEXT = .gmo | |
67 | INSTOBJEXT = .mo | |
68 | ||
69 | .SUFFIXES: | |
70 | .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat | |
71 | ||
72 | .c.o: | |
73 | $(COMPILE) $< | |
74 | ||
75 | .po.pox: | |
76 | $(MAKE) $(GETTEXT_PACKAGE).pot | |
77 | $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox | |
78 | ||
79 | .po.mo: | |
80 | $(MSGFMT) -o $@ $< | |
81 | ||
82 | .po.gmo: | |
83 | file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ | |
84 | && rm -f $$file && $(GMSGFMT) -c -o $$file $< | |
85 | ||
86 | .po.cat: | |
87 | sed -f ../intl/po2msg.sed < $< > $*.msg \ | |
88 | && rm -f $@ && $(GENCAT) $@ $*.msg | |
89 | ||
90 | ||
91 | all: all-@USE_NLS@ | |
92 | ||
93 | all-yes: $(CATALOGS) | |
94 | all-no: | |
95 | ||
96 | $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) | |
97 | $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \ | |
98 | --add-comments --keyword=_ --keyword=N_ \ | |
99 | --flag=g_strdup_printf:1:c-format \ | |
100 | --flag=g_string_printf:2:c-format \ | |
101 | --flag=g_string_append_printf:2:c-format \ | |
102 | --flag=g_error_new:3:c-format \ | |
103 | --flag=g_set_error:4:c-format \ | |
104 | --flag=g_markup_printf_escaped:1:c-format \ | |
105 | --flag=g_log:3:c-format \ | |
106 | --flag=g_print:1:c-format \ | |
107 | --flag=g_printerr:1:c-format \ | |
108 | --flag=g_printf:1:c-format \ | |
109 | --flag=g_fprintf:2:c-format \ | |
110 | --flag=g_sprintf:2:c-format \ | |
111 | --flag=g_snprintf:3:c-format \ | |
112 | --flag=g_scanner_error:2:c-format \ | |
113 | --flag=g_scanner_warn:2:c-format \ | |
114 | --files-from=$(srcdir)/POTFILES.in \ | |
115 | && test ! -f $(GETTEXT_PACKAGE).po \ | |
116 | || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \ | |
117 | && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot ) | |
118 | ||
119 | install: install-exec install-data | |
120 | install-exec: | |
121 | install-data: install-data-@USE_NLS@ | |
122 | install-data-no: all | |
123 | install-data-yes: all | |
124 | if test -r "$(MKINSTALLDIRS)"; then \ | |
125 | $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ | |
126 | else \ | |
127 | $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ | |
128 | fi | |
129 | @catalogs='$(CATALOGS)'; \ | |
130 | for cat in $$catalogs; do \ | |
131 | cat=`basename $$cat`; \ | |
132 | case "$$cat" in \ | |
133 | *.gmo) destdir=$(gnulocaledir);; \ | |
134 | *) destdir=$(localedir);; \ | |
135 | esac; \ | |
136 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ | |
137 | dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ | |
138 | if test -r "$(MKINSTALLDIRS)"; then \ | |
139 | $(MKINSTALLDIRS) $$dir; \ | |
140 | else \ | |
141 | $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ | |
142 | fi; \ | |
143 | if test -r $$cat; then \ | |
144 | $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ | |
145 | echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ | |
146 | else \ | |
147 | $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ | |
148 | echo "installing $(srcdir)/$$cat as" \ | |
149 | "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ | |
150 | fi; \ | |
151 | if test -r $$cat.m; then \ | |
152 | $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ | |
153 | echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ | |
154 | else \ | |
155 | if test -r $(srcdir)/$$cat.m ; then \ | |
156 | $(INSTALL_DATA) $(srcdir)/$$cat.m \ | |
157 | $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ | |
158 | echo "installing $(srcdir)/$$cat as" \ | |
159 | "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ | |
160 | else \ | |
161 | true; \ | |
162 | fi; \ | |
163 | fi; \ | |
164 | done | |
165 | if test "$(PACKAGE)" = "glib"; then \ | |
166 | if test -r "$(MKINSTALLDIRS)"; then \ | |
167 | $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ | |
168 | else \ | |
169 | $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ | |
170 | fi; \ | |
171 | $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ | |
172 | $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ | |
173 | else \ | |
174 | : ; \ | |
175 | fi | |
176 | ||
177 | # Define this as empty until I found a useful application. | |
178 | installcheck: | |
179 | ||
180 | uninstall: | |
181 | catalogs='$(CATALOGS)'; \ | |
182 | for cat in $$catalogs; do \ | |
183 | cat=`basename $$cat`; \ | |
184 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ | |
185 | rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ | |
186 | rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ | |
187 | rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ | |
188 | rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ | |
189 | done | |
190 | if test "$(PACKAGE)" = "glib"; then \ | |
191 | rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ | |
192 | fi | |
193 | ||
194 | check: all | |
195 | ||
196 | dvi info tags TAGS ID: | |
197 | ||
198 | mostlyclean: | |
199 | rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp | |
200 | rm -fr *.o | |
201 | ||
202 | clean: mostlyclean | |
203 | ||
204 | distclean: clean | |
205 | rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m | |
206 | ||
207 | maintainer-clean: distclean | |
208 | @echo "This command is intended for maintainers to use;" | |
209 | @echo "it deletes files that may require special tools to rebuild." | |
210 | rm -f $(GMOFILES) | |
211 | ||
212 | distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir) | |
213 | dist distdir: update-po $(DISTFILES) | |
214 | dists="$(DISTFILES)"; \ | |
215 | for file in $$dists; do \ | |
216 | ln $(srcdir)/$$file $(distdir) 2> /dev/null \ | |
217 | || cp -p $(srcdir)/$$file $(distdir); \ | |
218 | done | |
219 | ||
220 | update-po: Makefile | |
221 | $(MAKE) $(GETTEXT_PACKAGE).pot | |
222 | tmpdir=`pwd`; \ | |
223 | cd $(srcdir); \ | |
224 | catalogs='$(CATALOGS)'; \ | |
225 | for cat in $$catalogs; do \ | |
226 | cat=`basename $$cat`; \ | |
227 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ | |
228 | echo "$$lang:"; \ | |
229 | if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \ | |
230 | if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ | |
231 | rm -f $$tmpdir/$$lang.new.po; \ | |
232 | else \ | |
233 | if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ | |
234 | :; \ | |
235 | else \ | |
236 | echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ | |
237 | rm -f $$tmpdir/$$lang.new.po; \ | |
238 | exit 1; \ | |
239 | fi; \ | |
240 | fi; \ | |
241 | else \ | |
242 | echo "msgmerge for $$cat failed!"; \ | |
243 | rm -f $$tmpdir/$$lang.new.po; \ | |
244 | fi; \ | |
245 | done | |
246 | ||
247 | # POTFILES is created from POTFILES.in by stripping comments, empty lines | |
248 | # and Intltool tags (enclosed in square brackets), and appending a full | |
249 | # relative path to them | |
250 | POTFILES: POTFILES.in | |
251 | ( if test 'x$(srcdir)' != 'x.'; then \ | |
252 | posrcprefix='$(top_srcdir)/'; \ | |
253 | else \ | |
254 | posrcprefix="../"; \ | |
255 | fi; \ | |
256 | rm -f $@-t $@ \ | |
257 | && (sed -e '/^#/d' \ | |
258 | -e "s/^\[.*\] +//" \ | |
259 | -e '/^[ ]*$$/d' \ | |
260 | -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ | |
261 | | sed -e '$$s/\\$$//') > $@-t \ | |
262 | && chmod a-w $@-t \ | |
263 | && mv $@-t $@ ) | |
264 | ||
265 | Makefile: Makefile.in.in ../config.status POTFILES | |
266 | cd .. \ | |
267 | && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ | |
268 | $(SHELL) ./config.status | |
269 | ||
270 | # Tell versions [3.59,3.63) of GNU make not to export all variables. | |
271 | # Otherwise a system limit (for SysV at least) may be exceeded. | |
272 | .NOEXPORT: |