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 \
75 && rm -f $$file && $(GMSGFMT) -o $$file $<
78 sed -f ../intl/po2msg.sed < $< > $*.msg \
79 && rm -f $@ && $(GENCAT) $@ $*.msg
84 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
87 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
88 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
89 --add-comments -C --keyword=_ --keyword=N_ \
90 --files-from=$(srcdir)/POTFILES.in
91 rm -f $(srcdir)/$(PACKAGE).pot
92 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
94 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
95 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
97 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
98 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
99 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
102 echo cat-id-tbl.c changed; \
103 rm -f $(srcdir)/cat-id-tbl.c; \
104 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
106 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
109 install: install-exec install-data
112 install-data: install-data-@USE_NLS@
114 install-data-yes: all
115 if test -r $(MKINSTALLDIRS); then \
116 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
118 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
120 @catalogs='$(CATALOGS)'; \
121 for cat in $$catalogs; do \
122 cat=`basename $$cat`; \
124 *.gmo) destdir=$(gnulocaledir);; \
125 *) destdir=$(localedir);; \
127 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
128 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
129 if test -r $(MKINSTALLDIRS); then \
130 $(MKINSTALLDIRS) $$dir; \
132 $(top_srcdir)/mkinstalldirs $$dir; \
134 if test -r $$cat; then \
135 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
136 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
138 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
139 echo "installing $(srcdir)/$$cat as" \
140 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
142 if test -r $$cat.m; then \
143 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
144 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
146 if test -r $(srcdir)/$$cat.m ; then \
147 $(INSTALL_DATA) $(srcdir)/$$cat.m \
148 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
149 echo "installing $(srcdir)/$$cat as" \
150 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
156 if test "$(PACKAGE)" = "gettext"; then \
157 if test -r $(MKINSTALLDIRS); then \
158 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
160 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
162 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
163 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
168 # Define this as empty until I found a useful application.
172 catalogs='$(CATALOGS)'; \
173 for cat in $$catalogs; do \
174 cat=`basename $$cat`; \
175 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
176 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
177 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
178 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
179 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
181 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
185 cat-id-tbl.o: ../intl/libgettext.h
187 dvi info tags TAGS ID:
190 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
196 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
198 maintainer-clean: distclean
199 @echo "This command is intended for maintainers to use;"
200 @echo "it deletes files that may require special tools to rebuild."
203 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
204 dist distdir: update-po $(DISTFILES)
205 dists="$(DISTFILES)"; \
206 for file in $$dists; do \
207 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
208 || cp -p $(srcdir)/$$file $(distdir); \
212 $(MAKE) $(PACKAGE).pot
213 PATH=`pwd`/../src:$$PATH; \
215 catalogs='$(CATALOGS)'; \
216 for cat in $$catalogs; do \
217 cat=`basename $$cat`; \
218 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
219 mv $$lang.po $$lang.old.po; \
221 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
222 rm -f $$lang.old.po; \
224 echo "msgmerge for $$cat failed!"; \
226 mv $$lang.old.po $$lang.po; \
230 POTFILES: POTFILES.in
231 ( if test 'x$(srcdir)' != 'x.'; then \
232 posrcprefix='$(top_srcdir)/'; \
237 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
238 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
239 | sed -e '$$s/\\$$//') > $@-t \
243 POTFILES.in: @MAINT@ ../Makefile
244 cd .. && $(MAKE) po/POTFILES.in
246 Makefile: Make-in ../config.status POTFILES
248 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
249 CONFIG_HEADERS= $(SHELL) ./config.status
251 # Tell versions [3.59,3.63) of GNU make not to export all variables.
252 # Otherwise a system limit (for SysV at least) may be exceeded.