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
28 INSTALL_DATA = @INSTALL_DATA@
29 MKINSTALLDIRS = @MKINSTALLDIRS@
33 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
35 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
36 MSGMERGE = PATH=../src:$$PATH msgmerge
42 INCLUDES = -I.. -I$(top_srcdir)/intl
44 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
46 SOURCES = cat-id-tbl.c
49 DISTFILES = ChangeLog Makefile.in.in SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \
50 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
52 # Note - the following line gets processed by bfd/configure and amended
53 # to contain the full list of source dir POTFILES.
56 # Note - the following line gets processed by bfd/configure and amended
57 # to contain the full list of build dir POTFILES.
61 CATOBJEXT = @CATOBJEXT@
62 INSTOBJEXT = @INSTOBJEXT@
65 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
71 $(MAKE) $(PACKAGE).pot
72 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
78 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
79 && rm -f $$file && $(GMSGFMT) -o $$file $<
82 sed -f ../intl/po2msg.sed < $< > $*.msg \
83 && rm -f $@ && $(GENCAT) $@ $*.msg
88 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
91 $(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
92 $(XGETTEXT) --default-domain=$(PACKAGE) \
93 --directory=$(top_srcdir) \
94 --add-comments --keyword=_ --keyword=N_ \
95 --files-from=$(srcdir)/SRC-POTFILES.in
96 $(XGETTEXT) --default-domain=$(PACKAGE) \
99 --add-comments --keyword=_ --keyword=N_ \
101 --files-from=$(srcdir)/BLD-POTFILES.in
102 rm -f $(srcdir)/$(PACKAGE).pot
103 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
105 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
106 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
108 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
109 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
110 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
113 echo cat-id-tbl.c changed; \
114 rm -f $(srcdir)/cat-id-tbl.c; \
115 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
117 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
120 install: install-exec install-data
123 install-data: install-data-@USE_NLS@
125 install-data-yes: all
126 if test -r $(MKINSTALLDIRS); then \
127 $(MKINSTALLDIRS) $(datadir); \
129 $(top_srcdir)/mkinstalldirs $(datadir); \
131 @catalogs='$(CATALOGS)'; \
132 for cat in $$catalogs; do \
133 cat=`basename $$cat`; \
135 *.gmo) destdir=$(gnulocaledir);; \
136 *) destdir=$(localedir);; \
138 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
139 dir=$$destdir/$$lang/LC_MESSAGES; \
140 if test -r $(MKINSTALLDIRS); then \
141 $(MKINSTALLDIRS) $$dir; \
143 $(top_srcdir)/mkinstalldirs $$dir; \
145 if test -r $$cat; then \
146 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
147 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
149 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
150 echo "installing $(srcdir)/$$cat as" \
151 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
153 if test -r $$cat.m; then \
154 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
155 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
157 if test -r $(srcdir)/$$cat.m ; then \
158 $(INSTALL_DATA) $(srcdir)/$$cat.m \
159 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
160 echo "installing $(srcdir)/$$cat as" \
161 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
167 if test "$(PACKAGE)" = "gettext"; then \
168 if test -r $(MKINSTALLDIRS); then \
169 $(MKINSTALLDIRS) $(gettextsrcdir); \
171 $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
173 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
174 $(gettextsrcdir)/Makefile.in.in; \
179 # Define this as empty until I found a useful application.
183 catalogs='$(CATALOGS)'; \
184 for cat in $$catalogs; do \
185 cat=`basename $$cat`; \
186 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
187 rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
188 rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
189 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
190 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
192 rm -f $(gettextsrcdir)/po-Makefile.in.in
196 cat-id-tbl.o: ../intl/libgettext.h
198 dvi info tags TAGS ID:
201 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
206 # FIXME: cagney/2001-11-18: When configuring / building in the source
207 # directory, the rule below would delete SRC-POTFILES.in and
208 # BLD-POTFILES.in from that source directory. While a make rebuilds
209 # these files it also puts them in the source directory and that can
213 rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
214 rm -f SRC-POTFILES BLD-POTFILES
216 maintainer-clean: distclean
217 @echo "This command is intended for maintainers to use;"
218 @echo "it deletes files that may require special tools to rebuild."
221 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
222 dist distdir: update-po $(DISTFILES)
223 dists="$(DISTFILES)"; \
224 for file in $$dists; do \
225 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
226 || cp -p $(srcdir)/$$file $(distdir); \
230 $(MAKE) $(PACKAGE).pot
231 PATH=`pwd`/../src:$$PATH; \
233 catalogs='$(CATALOGS)'; \
234 for cat in $$catalogs; do \
235 cat=`basename $$cat`; \
236 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
237 mv $$lang.po $$lang.old.po; \
239 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
240 rm -f $$lang.old.po; \
242 echo "msgmerge for $$cat failed!"; \
244 mv $$lang.old.po $$lang.po; \
248 SRC-POTFILES: SRC-POTFILES.in
249 ( if test 'x$(srcdir)' != 'x.'; then \
250 posrcprefix='$(top_srcdir)/'; \
257 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
258 | sed -e '$$s/\\$$//') > $@-t \
262 BLD-POTFILES: BLD-POTFILES.in
266 -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \
267 | sed -e '$$s/\\$$//') > $@-t \
271 SRC-POTFILES.in: @MAINT@ ../Makefile
272 cd .. && $(MAKE) po/SRC-POTFILES.in
274 BLD-POTFILES.in: @MAINT@ ../Makefile
275 cd .. && $(MAKE) po/BLD-POTFILES.in
277 # Note - The presence of SRC-POTFILES and BLD-POTFILES as dependencies
278 # here breaks the implementation of the 'distclean' rule for maintainers.
279 # This is because if 'make distclean' is run in the BFD directory, the
280 # Makefile there will be deleted before 'distclean' is made here, and so
281 # the dependency SRC-POTFILES -> SRC-POTFILES.in -> ../Makefile cannot
284 # The SRC-POTFILES and BLD-POTFILES dependencies cannot be removed,
285 # however since it is necessary that these files be built during
286 # *configure* time, so that configure can insert them into the
287 # po/Makefile that it is creating, so that the Makefile will have
288 # the correct dependencies.
289 Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES
291 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
292 CONFIG_HEADERS= $(SHELL) ./config.status
294 # Tell versions [3.59,3.63) of GNU make not to export all variables.
295 # Otherwise a system limit (for SysV at least) may be exceeded.