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 2003, 2006 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@
19 top_builddir = @top_builddir@
22 exec_prefix = @exec_prefix@
23 datadir = $(prefix)/@DATADIRNAME@
24 localedir = $(datadir)/locale
25 gnulocaledir = $(prefix)/share/locale
26 gettextsrcdir = $(prefix)/share/gettext/po
32 INSTALL_DATA = @INSTALL_DATA@
33 MKINSTALLDIRS = @MKINSTALLDIRS@
37 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
39 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
40 MSGMERGE = PATH=../src:$$PATH msgmerge
46 INCLUDES = -I.. -I$(top_srcdir)/intl
48 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
50 SOURCES = cat-id-tbl.c
53 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
54 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
59 CATOBJEXT = @CATOBJEXT@
60 INSTOBJEXT = @INSTOBJEXT@
63 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
69 $(MAKE) $(PACKAGE).pot
70 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
76 file=`echo $* | sed 's,.*/,,'`.gmo \
77 && rm -f $$file && $(GMSGFMT) -o $$file $<
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 --msgid-bugs-address=bug-binutils@gnu.org \
93 --files-from=$(srcdir)/POTFILES.in
94 rm -f $(srcdir)/$(PACKAGE).pot
95 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
97 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
98 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
100 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
101 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
102 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
105 echo cat-id-tbl.c changed; \
106 rm -f $(srcdir)/cat-id-tbl.c; \
107 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
109 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
112 install: install-exec install-data
116 install-data: install-data-@USE_NLS@
118 install-data-yes: all
119 if test -r $(MKINSTALLDIRS); then \
120 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
122 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
124 @catalogs='$(CATALOGS)'; \
125 for cat in $$catalogs; do \
126 cat=`basename $$cat`; \
128 *.gmo) destdir=$(gnulocaledir);; \
129 *) destdir=$(localedir);; \
131 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
132 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
133 if test -r $(MKINSTALLDIRS); then \
134 $(MKINSTALLDIRS) $$dir; \
136 $(top_srcdir)/mkinstalldirs $$dir; \
138 if test -r $$cat; then \
139 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
140 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
142 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
143 echo "installing $(srcdir)/$$cat as" \
144 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
146 if test -r $$cat.m; then \
147 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
148 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
150 if test -r $(srcdir)/$$cat.m ; then \
151 $(INSTALL_DATA) $(srcdir)/$$cat.m \
152 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
153 echo "installing $(srcdir)/$$cat as" \
154 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
160 if test "$(PACKAGE)" = "gettext"; then \
161 if test -r $(MKINSTALLDIRS); then \
162 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
164 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
166 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
167 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
172 # Define this as empty until I found a useful application.
176 catalogs='$(CATALOGS)'; \
177 for cat in $$catalogs; do \
178 cat=`basename $$cat`; \
179 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
180 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
181 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
182 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
183 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
185 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
189 cat-id-tbl.o: ../intl/libgettext.h
191 html dvi pdf ps info tags TAGS ID:
194 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
200 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
202 maintainer-clean: distclean
203 @echo "This command is intended for maintainers to use;"
204 @echo "it deletes files that may require special tools to rebuild."
207 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
208 dist distdir: update-po $(DISTFILES)
209 dists="$(DISTFILES)"; \
210 for file in $$dists; do \
211 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
212 || cp -p $(srcdir)/$$file $(distdir); \
216 $(MAKE) $(PACKAGE).pot
217 PATH=`pwd`/../src:$$PATH; \
219 catalogs='$(CATALOGS)'; \
220 for cat in $$catalogs; do \
221 cat=`basename $$cat`; \
222 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
223 mv $$lang.po $$lang.old.po; \
225 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
226 rm -f $$lang.old.po; \
228 echo "msgmerge for $$cat failed!"; \
230 mv $$lang.old.po $$lang.po; \
234 POTFILES: POTFILES.in
235 ( if test 'x$(srcdir)' != 'x.'; then \
236 posrcprefix='$(top_srcdir)/'; \
241 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
242 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
243 | sed -e '$$s/\\$$//') > $@-t \
247 POTFILES.in: @MAINT@ ../Makefile
248 cd .. && $(MAKE) po/POTFILES.in
250 Makefile: Make-in ../config.status POTFILES
252 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
253 CONFIG_HEADERS= $(SHELL) ./config.status
255 # Tell versions [3.59,3.63) of GNU make not to export all variables.
256 # Otherwise a system limit (for SysV at least) may be exceeded.