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>
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.
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/
12 # - Modified by jacob berkman <jacob@ximian.com> to install
13 # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
15 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
23 top_srcdir = @top_srcdir@
27 exec_prefix = @exec_prefix@
28 datadir = $(prefix)/@DATADIRNAME@
29 localedir = $(datadir)/locale
30 gnulocaledir = $(prefix)/share/locale
31 gettextsrcdir = $(prefix)/share/glib-2.0/gettext/po
35 INSTALL_DATA = @INSTALL_DATA@
36 MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
40 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
42 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
43 MSGMERGE = PATH=../src:$$PATH msgmerge
49 INCLUDES = -I.. -I$(top_srcdir)/intl
51 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
56 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
57 $(POFILES) $(GMOFILES) $(SOURCES)
62 CATOBJEXT = @CATOBJEXT@
63 INSTOBJEXT = @INSTOBJEXT@
66 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
72 $(MAKE) $(GETTEXT_PACKAGE).pot
73 $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
79 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
80 && rm -f $$file && $(GMSGFMT) -o $$file $<
83 sed -f ../intl/po2msg.sed < $< > $*.msg \
84 && rm -f $@ && $(GENCAT) $@ $*.msg
92 $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
93 $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
94 --add-comments --keyword=_ --keyword=N_ \
95 --files-from=$(srcdir)/POTFILES.in \
96 && test ! -f $(GETTEXT_PACKAGE).po \
97 || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
98 && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
100 install: install-exec install-data
102 install-data: install-data-@USE_NLS@
104 install-data-yes: all
105 if test -r "$(MKINSTALLDIRS)"; then \
106 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
108 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
110 @catalogs='$(CATALOGS)'; \
111 for cat in $$catalogs; do \
112 cat=`basename $$cat`; \
114 *.gmo) destdir=$(gnulocaledir);; \
115 *) destdir=$(localedir);; \
117 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
118 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
119 if test -r "$(MKINSTALLDIRS)"; then \
120 $(MKINSTALLDIRS) $$dir; \
122 $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
124 if test -r $$cat; then \
125 $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
126 echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
128 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
129 echo "installing $(srcdir)/$$cat as" \
130 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
132 if test -r $$cat.m; then \
133 $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
134 echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
136 if test -r $(srcdir)/$$cat.m ; then \
137 $(INSTALL_DATA) $(srcdir)/$$cat.m \
138 $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
139 echo "installing $(srcdir)/$$cat as" \
140 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
146 if test "$(PACKAGE)" = "glib"; then \
147 if test -r "$(MKINSTALLDIRS)"; then \
148 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
150 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
152 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
153 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
158 # Define this as empty until I found a useful application.
162 catalogs='$(CATALOGS)'; \
163 for cat in $$catalogs; do \
164 cat=`basename $$cat`; \
165 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
166 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
167 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
168 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
169 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
171 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
175 dvi info tags TAGS ID:
178 rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
184 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
186 maintainer-clean: distclean
187 @echo "This command is intended for maintainers to use;"
188 @echo "it deletes files that may require special tools to rebuild."
191 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
192 dist distdir: update-po $(DISTFILES)
193 dists="$(DISTFILES)"; \
194 for file in $$dists; do \
195 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
196 || cp -p $(srcdir)/$$file $(distdir); \
200 $(MAKE) $(GETTEXT_PACKAGE).pot
201 PATH=`pwd`/../src:$$PATH; \
203 catalogs='$(CATALOGS)'; \
204 for cat in $$catalogs; do \
205 cat=`basename $$cat`; \
206 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
207 mv $$lang.po $$lang.old.po; \
209 if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \
210 rm -f $$lang.old.po; \
212 echo "msgmerge for $$cat failed!"; \
214 mv $$lang.old.po $$lang.po; \
218 # POTFILES is created from POTFILES.in by stripping comments, empty lines
219 # and Intltool tags (enclosed in square brackets), and appending a full
220 # relative path to them
221 POTFILES: POTFILES.in
222 ( if test 'x$(srcdir)' != 'x.'; then \
223 posrcprefix='$(top_srcdir)/'; \
231 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
232 | sed -e '$$s/\\$$//') > $@-t \
236 Makefile: Makefile.in.in ../config.status POTFILES
238 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
239 $(SHELL) ./config.status
241 # Tell versions [3.59,3.63) of GNU make not to export all variables.
242 # Otherwise a system limit (for SysV at least) may be exceeded.