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>
3 # Copyright 2001, 2003 Free Software Foundation, Inc.
5 # This file may be copied and used freely without restrictions. It can
6 # be used in projects which are not available under the GNU Public License
7 # but which still want to provide support for the GNU gettext functionality.
8 # Please note that the actual code is *not* freely available.
17 top_srcdir = @top_srcdir@
21 exec_prefix = @exec_prefix@
22 datadir = $(prefix)/@DATADIRNAME@
23 localedir = $(datadir)/locale
24 gnulocaledir = $(prefix)/share/locale
25 gettextsrcdir = $(prefix)/share/gettext/po
31 INSTALL_DATA = @INSTALL_DATA@
32 MKINSTALLDIRS = @MKINSTALLDIRS@
36 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
38 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
39 MSGMERGE = PATH=../src:$$PATH msgmerge
45 INCLUDES = -I.. -I$(top_srcdir)/intl
47 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
49 SOURCES = cat-id-tbl.c
52 DISTFILES = ChangeLog Makefile.in.in SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \
53 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
55 # Note - the following line gets processed by bfd/configure and amended
56 # to contain the full list of source dir POTFILES.
59 # Note - the following line gets processed by bfd/configure and amended
60 # to contain the full list of build dir POTFILES.
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 && rm -f $$file && $(GMSGFMT) -o $$file $<
85 sed -f ../intl/po2msg.sed < $< > $*.msg \
86 && rm -f $@ && $(GENCAT) $@ $*.msg
91 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
94 $(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
95 $(XGETTEXT) --default-domain=$(PACKAGE) \
96 --directory=$(top_srcdir) \
97 --add-comments --keyword=_ --keyword=N_ \
98 --files-from=$(srcdir)/SRC-POTFILES.in
99 $(XGETTEXT) --default-domain=$(PACKAGE) \
102 --add-comments --keyword=_ --keyword=N_ \
104 --files-from=$(srcdir)/BLD-POTFILES.in
105 rm -f $(srcdir)/$(PACKAGE).pot
106 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
108 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
109 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
111 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
112 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
113 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
116 echo cat-id-tbl.c changed; \
117 rm -f $(srcdir)/cat-id-tbl.c; \
118 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
120 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
123 install: install-exec install-data
126 install-data: install-data-@USE_NLS@
128 install-data-yes: all
129 if test -r $(MKINSTALLDIRS); then \
130 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
132 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
134 @catalogs='$(CATALOGS)'; \
135 for cat in $$catalogs; do \
136 cat=`basename $$cat`; \
138 *.gmo) destdir=$(gnulocaledir);; \
139 *) destdir=$(localedir);; \
141 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
142 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
143 if test -r $(MKINSTALLDIRS); then \
144 $(MKINSTALLDIRS) $$dir; \
146 $(top_srcdir)/mkinstalldirs $$dir; \
148 if test -r $$cat; then \
149 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
150 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
152 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
153 echo "installing $(srcdir)/$$cat as" \
154 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
156 if test -r $$cat.m; then \
157 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
158 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
160 if test -r $(srcdir)/$$cat.m ; then \
161 $(INSTALL_DATA) $(srcdir)/$$cat.m \
162 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
163 echo "installing $(srcdir)/$$cat as" \
164 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
170 if test "$(PACKAGE)" = "gettext"; then \
171 if test -r $(MKINSTALLDIRS); then \
172 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
174 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
176 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
177 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
182 # Define this as empty until I found a useful application.
186 catalogs='$(CATALOGS)'; \
187 for cat in $$catalogs; do \
188 cat=`basename $$cat`; \
189 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
190 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
191 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
192 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
193 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
195 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
199 cat-id-tbl.o: ../intl/libgettext.h
201 html dvi info tags TAGS ID:
204 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
210 rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
211 rm -f SRC-POTFILES BLD-POTFILES
213 maintainer-clean: distclean
214 @echo "This command is intended for maintainers to use;"
215 @echo "it deletes files that may require special tools to rebuild."
216 rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in
218 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
219 dist distdir: update-po $(DISTFILES)
220 dists="$(DISTFILES)"; \
221 for file in $$dists; do \
222 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
223 || cp -p $(srcdir)/$$file $(distdir); \
227 $(MAKE) $(PACKAGE).pot
228 PATH=`pwd`/../src:$$PATH; \
230 catalogs='$(CATALOGS)'; \
231 for cat in $$catalogs; do \
232 cat=`basename $$cat`; \
233 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
234 mv $$lang.po $$lang.old.po; \
236 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
237 rm -f $$lang.old.po; \
239 echo "msgmerge for $$cat failed!"; \
241 mv $$lang.old.po $$lang.po; \
245 SRC-POTFILES: SRC-POTFILES.in
246 ( if test 'x$(srcdir)' != 'x.'; then \
247 posrcprefix='$(top_srcdir)/'; \
254 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
255 | sed -e '$$s/\\$$//') > $@-t \
259 BLD-POTFILES: BLD-POTFILES.in
263 -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \
264 | sed -e '$$s/\\$$//') > $@-t \
268 SRC-POTFILES.in: @MAINT@ ../Makefile
269 cd .. && $(MAKE) po/SRC-POTFILES.in
271 BLD-POTFILES.in: @MAINT@ ../Makefile
272 cd .. && $(MAKE) po/BLD-POTFILES.in
274 # Note - The presence of SRC-POTFILES and BLD-POTFILES as dependencies
275 # here breaks the implementation of the 'distclean' rule for maintainers.
276 # This is because if 'make distclean' is run in the BFD directory, the
277 # Makefile there will be deleted before 'distclean' is made here, and so
278 # the dependency SRC-POTFILES -> SRC-POTFILES.in -> ../Makefile cannot
281 # The SRC-POTFILES and BLD-POTFILES dependencies cannot be removed,
282 # however since it is necessary that these files be built during
283 # *configure* time, so that configure can insert them into the
284 # po/Makefile that it is creating, so that the Makefile will have
285 # the correct dependencies.
286 Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES
288 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
289 CONFIG_HEADERS= $(SHELL) ./config.status
291 # Tell versions [3.59,3.63) of GNU make not to export all variables.
292 # Otherwise a system limit (for SysV at least) may be exceeded.