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 SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \
52 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
54 # Note - the following line gets processed by bfd/configure and amended
55 # to contain the full list of source dir POTFILES.
58 # Note - the following line gets processed by bfd/configure and amended
59 # to contain the full list of build dir POTFILES.
63 CATOBJEXT = @CATOBJEXT@
64 INSTOBJEXT = @INSTOBJEXT@
67 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
73 $(MAKE) $(PACKAGE).pot
74 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
80 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
81 && rm -f $$file && $(GMSGFMT) -o $$file $<
84 sed -f ../intl/po2msg.sed < $< > $*.msg \
85 && rm -f $@ && $(GENCAT) $@ $*.msg
90 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
93 $(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
94 $(XGETTEXT) --default-domain=$(PACKAGE) \
95 --directory=$(top_srcdir) \
96 --add-comments --keyword=_ --keyword=N_ \
97 --files-from=$(srcdir)/SRC-POTFILES.in
98 $(XGETTEXT) --default-domain=$(PACKAGE) \
101 --add-comments --keyword=_ --keyword=N_ \
103 --files-from=$(srcdir)/BLD-POTFILES.in
104 rm -f $(srcdir)/$(PACKAGE).pot
105 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
107 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
108 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
110 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
111 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
112 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
115 echo cat-id-tbl.c changed; \
116 rm -f $(srcdir)/cat-id-tbl.c; \
117 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
119 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
122 install: install-exec install-data
125 install-data: install-data-@USE_NLS@
127 install-data-yes: all
128 if test -r $(MKINSTALLDIRS); then \
129 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
131 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
133 @catalogs='$(CATALOGS)'; \
134 for cat in $$catalogs; do \
135 cat=`basename $$cat`; \
137 *.gmo) destdir=$(gnulocaledir);; \
138 *) destdir=$(localedir);; \
140 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
141 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
142 if test -r $(MKINSTALLDIRS); then \
143 $(MKINSTALLDIRS) $$dir; \
145 $(top_srcdir)/mkinstalldirs $$dir; \
147 if test -r $$cat; then \
148 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
149 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
151 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
152 echo "installing $(srcdir)/$$cat as" \
153 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
155 if test -r $$cat.m; then \
156 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
157 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
159 if test -r $(srcdir)/$$cat.m ; then \
160 $(INSTALL_DATA) $(srcdir)/$$cat.m \
161 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
162 echo "installing $(srcdir)/$$cat as" \
163 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
169 if test "$(PACKAGE)" = "gettext"; then \
170 if test -r $(MKINSTALLDIRS); then \
171 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
173 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
175 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
176 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
181 # Define this as empty until I found a useful application.
185 catalogs='$(CATALOGS)'; \
186 for cat in $$catalogs; do \
187 cat=`basename $$cat`; \
188 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
189 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
190 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
191 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
192 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
194 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
198 cat-id-tbl.o: ../intl/libgettext.h
200 dvi info tags TAGS ID:
203 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
209 rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
210 rm -f SRC-POTFILES BLD-POTFILES
212 maintainer-clean: distclean
213 @echo "This command is intended for maintainers to use;"
214 @echo "it deletes files that may require special tools to rebuild."
215 rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in
217 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
218 dist distdir: update-po $(DISTFILES)
219 dists="$(DISTFILES)"; \
220 for file in $$dists; do \
221 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
222 || cp -p $(srcdir)/$$file $(distdir); \
226 $(MAKE) $(PACKAGE).pot
227 PATH=`pwd`/../src:$$PATH; \
229 catalogs='$(CATALOGS)'; \
230 for cat in $$catalogs; do \
231 cat=`basename $$cat`; \
232 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
233 mv $$lang.po $$lang.old.po; \
235 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
236 rm -f $$lang.old.po; \
238 echo "msgmerge for $$cat failed!"; \
240 mv $$lang.old.po $$lang.po; \
244 SRC-POTFILES: SRC-POTFILES.in
245 ( if test 'x$(srcdir)' != 'x.'; then \
246 posrcprefix='$(top_srcdir)/'; \
253 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
254 | sed -e '$$s/\\$$//') > $@-t \
258 BLD-POTFILES: BLD-POTFILES.in
262 -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \
263 | sed -e '$$s/\\$$//') > $@-t \
267 SRC-POTFILES.in: @MAINT@ ../Makefile
268 cd .. && $(MAKE) po/SRC-POTFILES.in
270 BLD-POTFILES.in: @MAINT@ ../Makefile
271 cd .. && $(MAKE) po/BLD-POTFILES.in
273 # Note - The presence of SRC-POTFILES and BLD-POTFILES as dependencies
274 # here breaks the implementation of the 'distclean' rule for maintainers.
275 # This is because if 'make distclean' is run in the BFD directory, the
276 # Makefile there will be deleted before 'distclean' is made here, and so
277 # the dependency SRC-POTFILES -> SRC-POTFILES.in -> ../Makefile cannot
280 # The SRC-POTFILES and BLD-POTFILES dependencies cannot be removed,
281 # however since it is necessary that these files be built during
282 # *configure* time, so that configure can insert them into the
283 # po/Makefile that it is creating, so that the Makefile will have
284 # the correct dependencies.
285 Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES
287 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
288 CONFIG_HEADERS= $(SHELL) ./config.status
290 # Tell versions [3.59,3.63) of GNU make not to export all variables.
291 # Otherwise a system limit (for SysV at least) may be exceeded.