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.
16 top_srcdir = @top_srcdir@
20 exec_prefix = @exec_prefix@
21 datadir = $(prefix)/@DATADIRNAME@
22 localedir = $(datadir)/locale
23 gnulocaledir = $(prefix)/share/locale
24 gettextsrcdir = $(prefix)/share/gettext/po
30 INSTALL_DATA = @INSTALL_DATA@
31 MKINSTALLDIRS = @MKINSTALLDIRS@
35 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
37 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
38 MSGMERGE = PATH=../src:$$PATH msgmerge
44 INCLUDES = -I.. -I$(top_srcdir)/intl
46 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
48 SOURCES = cat-id-tbl.c
51 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
52 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
57 CATOBJEXT = @CATOBJEXT@
58 INSTOBJEXT = @INSTOBJEXT@
61 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
67 $(MAKE) $(PACKAGE).pot
68 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
74 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
76 && (rm -f $$file && $(GMSGFMT) -o $$file $< ) \
77 || echo "$$file is not writable"
80 sed -f ../intl/po2msg.sed < $< > $*.msg \
81 && rm -f $@ && $(GENCAT) $@ $*.msg
86 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
89 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
90 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
91 --add-comments --keyword=_ --keyword=N_ \
92 --files-from=$(srcdir)/POTFILES.in
93 rm -f $(srcdir)/$(PACKAGE).pot
94 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
96 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
97 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
99 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
100 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
101 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
104 echo cat-id-tbl.c changed; \
105 rm -f $(srcdir)/cat-id-tbl.c; \
106 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
108 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
111 install: install-exec install-data
114 install-data: install-data-@USE_NLS@
116 install-data-yes: all
117 if test -r $(MKINSTALLDIRS); then \
118 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
120 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
122 @catalogs='$(CATALOGS)'; \
123 for cat in $$catalogs; do \
124 cat=`basename $$cat`; \
126 *.gmo) destdir=$(gnulocaledir);; \
127 *) destdir=$(localedir);; \
129 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
130 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
131 if test -r $(MKINSTALLDIRS); then \
132 $(MKINSTALLDIRS) $$dir; \
134 $(top_srcdir)/mkinstalldirs $$dir; \
136 if test -r $$cat; then \
137 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
138 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
140 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
141 echo "installing $(srcdir)/$$cat as" \
142 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
144 if test -r $$cat.m; then \
145 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
146 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
148 if test -r $(srcdir)/$$cat.m ; then \
149 $(INSTALL_DATA) $(srcdir)/$$cat.m \
150 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
151 echo "installing $(srcdir)/$$cat as" \
152 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
158 if test "$(PACKAGE)" = "gettext"; then \
159 if test -r $(MKINSTALLDIRS); then \
160 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
162 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
164 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
165 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
170 # Define this as empty until I found a useful application.
174 catalogs='$(CATALOGS)'; \
175 for cat in $$catalogs; do \
176 cat=`basename $$cat`; \
177 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
178 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
179 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
180 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
181 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
183 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
187 cat-id-tbl.o: ../intl/libgettext.h
189 dvi info tags TAGS ID:
192 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
198 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
200 maintainer-clean: distclean
201 @echo "This command is intended for maintainers to use;"
202 @echo "it deletes files that may require special tools to rebuild."
205 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
206 dist distdir: update-po $(DISTFILES)
207 dists="$(DISTFILES)"; \
208 for file in $$dists; do \
209 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
210 || cp -p $(srcdir)/$$file $(distdir); \
214 $(MAKE) $(PACKAGE).pot
215 PATH=`pwd`/../src:$$PATH; \
217 catalogs='$(CATALOGS)'; \
218 for cat in $$catalogs; do \
219 cat=`basename $$cat`; \
220 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
221 mv $$lang.po $$lang.old.po; \
223 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
224 rm -f $$lang.old.po; \
226 echo "msgmerge for $$cat failed!"; \
228 mv $$lang.old.po $$lang.po; \
232 POTFILES: POTFILES.in
233 ( if test 'x$(srcdir)' != 'x.'; then \
234 posrcprefix='$(top_srcdir)/'; \
239 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
240 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
241 | sed -e '$$s/\\$$//') > $@-t \
245 POTFILES.in: @MAINT@ ../Makefile
246 cd .. && $(MAKE) po/POTFILES.in
248 Makefile: Make-in ../config.status POTFILES
250 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
251 CONFIG_HEADERS= $(SHELL) ./config.status
253 # Tell versions [3.59,3.63) of GNU make not to export all variables.
254 # Otherwise a system limit (for SysV at least) may be exceeded.