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 -C --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
117 install-data: install-data-@USE_NLS@
119 install-data-yes: all
120 if test -r $(MKINSTALLDIRS); then \
121 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
123 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
125 @catalogs='$(CATALOGS)'; \
126 for cat in $$catalogs; do \
127 cat=`basename $$cat`; \
129 *.gmo) destdir=$(gnulocaledir);; \
130 *) destdir=$(localedir);; \
132 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
133 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
134 if test -r $(MKINSTALLDIRS); then \
135 $(MKINSTALLDIRS) $$dir; \
137 $(top_srcdir)/mkinstalldirs $$dir; \
139 if test -r $$cat; then \
140 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
141 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
143 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
144 echo "installing $(srcdir)/$$cat as" \
145 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
147 if test -r $$cat.m; then \
148 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
149 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
151 if test -r $(srcdir)/$$cat.m ; then \
152 $(INSTALL_DATA) $(srcdir)/$$cat.m \
153 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
154 echo "installing $(srcdir)/$$cat as" \
155 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
161 if test "$(PACKAGE)" = "gettext"; then \
162 if test -r $(MKINSTALLDIRS); then \
163 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
165 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
167 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
168 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
173 # Define this as empty until I found a useful application.
177 catalogs='$(CATALOGS)'; \
178 for cat in $$catalogs; do \
179 cat=`basename $$cat`; \
180 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
181 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
182 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
183 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
184 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
186 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
190 cat-id-tbl.o: ../intl/libgettext.h
192 html dvi pdf ps info tags TAGS ID:
195 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
201 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
203 maintainer-clean: distclean
204 @echo "This command is intended for maintainers to use;"
205 @echo "it deletes files that may require special tools to rebuild."
208 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
209 dist distdir: update-po $(DISTFILES)
210 dists="$(DISTFILES)"; \
211 for file in $$dists; do \
212 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
213 || cp -p $(srcdir)/$$file $(distdir); \
217 $(MAKE) $(PACKAGE).pot
218 PATH=`pwd`/../src:$$PATH; \
220 catalogs='$(CATALOGS)'; \
221 for cat in $$catalogs; do \
222 cat=`basename $$cat`; \
223 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
224 mv $$lang.po $$lang.old.po; \
226 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
227 rm -f $$lang.old.po; \
229 echo "msgmerge for $$cat failed!"; \
231 mv $$lang.old.po $$lang.po; \
235 POTFILES: POTFILES.in
236 ( if test 'x$(srcdir)' != 'x.'; then \
237 posrcprefix='$(top_srcdir)/'; \
242 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
243 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
244 | sed -e '$$s/\\$$//') > $@-t \
248 POTFILES.in: @MAINT@ ../Makefile
249 cd .. && $(MAKE) po/POTFILES.in
251 Makefile: Make-in ../config.status POTFILES
253 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
254 CONFIG_HEADERS= $(SHELL) ./config.status
256 # Tell versions [3.59,3.63) of GNU make not to export all variables.
257 # Otherwise a system limit (for SysV at least) may be exceeded.