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 (C) 2003, 2006, 2007, 2009 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@
24 datarootdir = @datarootdir@
25 localedir = @localedir@
26 gnulocaledir = @localedir@
27 gettextsrcdir = $(prefix)/share/gettext/po
33 INSTALL_DATA = @INSTALL_DATA@
34 MKINSTALLDIRS = @MKINSTALLDIRS@
38 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
40 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
41 MSGMERGE = PATH=../src:$$PATH msgmerge
47 INCLUDES = -I.. -I$(top_srcdir)/intl
49 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
51 SOURCES = cat-id-tbl.c
54 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
55 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
60 CATOBJEXT = @CATOBJEXT@
61 INSTOBJEXT = @INSTOBJEXT@
64 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
70 $(MAKE) $(PACKAGE).pot
71 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
77 file=`echo $* | sed 's,.*/,,'`.gmo \
78 && rm -f $$file && $(GMSGFMT) -o $$file $<
81 sed -f ../intl/po2msg.sed < $< > $*.msg \
82 && rm -f $@ && $(GENCAT) $@ $*.msg
87 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
90 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
91 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
92 --add-comments --keyword=_ --keyword=N_ \
93 --msgid-bugs-address=bug-binutils@gnu.org \
94 --files-from=$(srcdir)/POTFILES.in
95 rm -f $(srcdir)/$(PACKAGE).pot
96 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
98 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
99 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
101 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
102 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
103 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
106 echo cat-id-tbl.c changed; \
107 rm -f $(srcdir)/cat-id-tbl.c; \
108 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
110 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
113 install: install-exec install-data
118 install-data: install-data-@USE_NLS@
120 install-data-yes: all
121 if test -r $(MKINSTALLDIRS); then \
122 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
124 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
126 @catalogs='$(CATALOGS)'; \
127 for cat in $$catalogs; do \
128 cat=`basename $$cat`; \
130 *.gmo) destdir=$(gnulocaledir);; \
131 *) destdir=$(localedir);; \
133 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
134 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
135 if test -r $(MKINSTALLDIRS); then \
136 $(MKINSTALLDIRS) $$dir; \
138 $(top_srcdir)/mkinstalldirs $$dir; \
140 if test -r $$cat; then \
141 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
142 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
144 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
145 echo "installing $(srcdir)/$$cat as" \
146 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
148 if test -r $$cat.m; then \
149 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
150 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
152 if test -r $(srcdir)/$$cat.m ; then \
153 $(INSTALL_DATA) $(srcdir)/$$cat.m \
154 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
155 echo "installing $(srcdir)/$$cat as" \
156 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
162 if test "$(PACKAGE)" = "gettext"; then \
163 if test -r $(MKINSTALLDIRS); then \
164 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
166 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
168 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
169 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
174 # Define this as empty until I found a useful application.
178 catalogs='$(CATALOGS)'; \
179 for cat in $$catalogs; do \
180 cat=`basename $$cat`; \
181 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
182 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
183 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
184 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
185 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
187 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
191 cat-id-tbl.o: ../intl/libgettext.h
193 html dvi pdf ps info tags TAGS ID:
196 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
202 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
204 maintainer-clean: distclean
205 @echo "This command is intended for maintainers to use;"
206 @echo "it deletes files that may require special tools to rebuild."
209 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
210 dist distdir: update-po $(DISTFILES)
211 dists="$(DISTFILES)"; \
212 for file in $$dists; do \
213 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
214 || cp -p $(srcdir)/$$file $(distdir); \
218 $(MAKE) $(PACKAGE).pot
219 PATH=`pwd`/../src:$$PATH; \
221 catalogs='$(CATALOGS)'; \
222 for cat in $$catalogs; do \
223 cat=`basename $$cat`; \
224 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
225 mv $$lang.po $$lang.old.po; \
227 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
228 rm -f $$lang.old.po; \
230 echo "msgmerge for $$cat failed!"; \
232 mv $$lang.old.po $$lang.po; \
236 POTFILES: POTFILES.in
237 ( if test 'x$(srcdir)' != 'x.'; then \
238 posrcprefix='$(top_srcdir)/'; \
243 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
244 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
245 | sed -e '$$s/\\$$//') > $@-t \
249 POTFILES.in: @MAINT@ ../Makefile
250 cd .. && $(MAKE) po/POTFILES.in
252 Makefile: Make-in ../config.status POTFILES
254 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
255 CONFIG_HEADERS= $(SHELL) ./config.status
257 # Tell versions [3.59,3.63) of GNU make not to export all variables.
258 # Otherwise a system limit (for SysV at least) may be exceeded.