1 # Makefile for program source directory in GNU NLS utilities package.
2 # Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 top_srcdir = @top_srcdir@
29 exec_prefix = @exec_prefix@
30 datadir = $(prefix)/@DATADIRNAME@
31 localedir = $(datadir)/locale
32 gnulocaledir = $(prefix)/share/locale
33 gettextsrcdir = $(prefix)/share/gettext/po
37 INSTALL_DATA = @INSTALL_DATA@
38 MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
42 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
44 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
45 MSGMERGE = PATH=../src:$$PATH msgmerge
51 INCLUDES = -I../src -I$(top_srcdir)/intl
53 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
55 SOURCES = cat-id-tbl.c
58 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
59 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
64 CATOBJEXT = @CATOBJEXT@
65 INSTOBJEXT = @INSTOBJEXT@
68 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
74 $(MAKE) $(PACKAGE).pot
75 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
81 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
82 && case "$(GMSGFMT)" in \
83 */msgfmt) rm -f $$file && $(GMSGFMT) -o $$file $<;; \
88 sed -f ../intl/po2msg.sed < $< > $*.msg \
89 && rm -f $@ && $(GENCAT) $@ $*.msg
94 all-yes: $(srcdir)/cat-id-tbl.c $(CATALOGS)
97 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
98 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
99 --add-comments --keyword=_ --keyword=N_ \
100 --files-from=$(srcdir)/POTFILES.in
101 rm -f $(srcdir)/$(PACKAGE).pot
102 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
104 $(srcdir)/cat-id-tbl.c: $(srcdir)/stamp-cat-id; @:
105 $(srcdir)/stamp-cat-id: $(srcdir)/$(PACKAGE).pot
107 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
108 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
109 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
112 echo cat-id-tbl.c changed; \
113 rm -f $(srcdir)/cat-id-tbl.c; \
114 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
116 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
119 install: install-exec install-data
121 install-data: install-data-@USE_NLS@
123 install-data-yes: all
124 if test -r $(MKINSTALLDIRS); then \
125 $(MKINSTALLDIRS) $(datadir); \
127 $(top_srcdir)/mkinstalldirs $(datadir); \
129 @catalogs='$(CATALOGS)'; \
130 for cat in $$catalogs; do \
131 cat=`basename $$cat`; \
133 *.gmo) destdir=$(gnulocaledir);; \
134 *) destdir=$(localedir);; \
136 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
137 dir=$$destdir/$$lang/LC_MESSAGES; \
138 if test -r $(MKINSTALLDIRS); then \
139 $(MKINSTALLDIRS) $$dir; \
141 $(top_srcdir)/mkinstalldirs $$dir; \
143 if test -r $$cat; then \
144 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
145 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
147 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
148 echo "installing $(srcdir)/$$cat as" \
149 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
151 if test -r $$cat.m; then \
152 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
153 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
155 if test -r $(srcdir)/$$cat.m ; then \
156 $(INSTALL_DATA) $(srcdir)/$$cat.m \
157 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
158 echo "installing $(srcdir)/$$cat as" \
159 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
165 if test "$(PACKAGE)" = "gettext"; then \
166 if test -r $(MKINSTALLDIRS); then \
167 $(MKINSTALLDIRS) $(gettextsrcdir); \
169 $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
171 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
172 $(gettextsrcdir)/Makefile.in.in; \
177 # Define this as empty until I found a useful application.
181 catalogs='$(CATALOGS)'; \
182 for cat in $$catalogs; do \
183 cat=`basename $$cat`; \
184 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
185 rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
186 rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
187 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
188 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
190 rm -f $(gettextsrcdir)/po-Makefile.in.in
194 cat-id-tbl.o: ../intl/libgettext.h
196 dvi info tags TAGS ID:
199 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
205 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
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."
212 distdir = ../$(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); \
221 $(MAKE) $(PACKAGE).pot
222 PATH=`pwd`/../src:$$PATH; \
224 catalogs='$(CATALOGS)'; \
225 for cat in $$catalogs; do \
226 cat=`basename $$cat`; \
227 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
228 mv $$lang.po $$lang.old.po; \
230 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
231 rm -f $$lang.old.po; \
233 echo "msgmerge for $$cat failed!"; \
235 mv $$lang.old.po $$lang.po; \
239 POTFILES: POTFILES.in
240 ( if test 'x$(srcdir)' != 'x.'; then \
241 posrcprefix='$(top_srcdir)/'; \
246 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
247 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
248 | sed -e '$$s/\\$$//') > $@-t \
252 Makefile: Makefile.in.in ../config.status POTFILES
254 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
255 $(SHELL) ./config.status
257 # Tell versions [3.59,3.63) of GNU make not to export all variables.
258 # Otherwise a system limit (for SysV at least) may be exceeded.