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-2018 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 localedir = @localedir@
25 gnulocaledir = @datarootdir@/locale
26 gettextsrcdir = @datarootdir@/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 SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \
54 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
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=`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) --directory=$(top_srcdir) \
93 --add-comments --keyword=_ --keyword=N_ \
94 --msgid-bugs-address=bug-binutils@gnu.org \
95 --files-from=$(srcdir)/SRC-POTFILES.in
96 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=.. \
97 --add-comments --keyword=_ --keyword=N_ \
99 --msgid-bugs-address=bug-binutils@gnu.org \
100 --files-from=$(srcdir)/BLD-POTFILES.in
101 rm -f $(srcdir)/$(PACKAGE).pot
102 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
104 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
105 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
107 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
108 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
109 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
112 echo cat-id-tbl.c changed; \
113 rm -f $(srcdir)/cat-id-tbl.c; \
114 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
116 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
119 install: install-exec install-data
124 install-data: install-data-@USE_NLS@
126 install-data-yes: all
127 if test -r $(MKINSTALLDIRS); then \
128 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
130 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
132 @catalogs='$(CATALOGS)'; \
133 for cat in $$catalogs; do \
134 cat=`basename $$cat`; \
136 *.gmo) destdir=$(gnulocaledir);; \
137 *) destdir=$(localedir);; \
139 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
140 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
141 if test -r $(MKINSTALLDIRS); then \
142 $(MKINSTALLDIRS) $$dir; \
144 $(top_srcdir)/mkinstalldirs $$dir; \
146 if test -r $$cat; then \
147 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
148 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
150 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
151 echo "installing $(srcdir)/$$cat as" \
152 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
154 if test -r $$cat.m; then \
155 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
156 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
158 if test -r $(srcdir)/$$cat.m ; then \
159 $(INSTALL_DATA) $(srcdir)/$$cat.m \
160 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
161 echo "installing $(srcdir)/$$cat as" \
162 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
168 if test "$(PACKAGE)" = "gettext"; then \
169 if test -r $(MKINSTALLDIRS); then \
170 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
172 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
174 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
175 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
180 # Define this as empty until I found a useful application.
184 catalogs='$(CATALOGS)'; \
185 for cat in $$catalogs; do \
186 cat=`basename $$cat`; \
187 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
188 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
189 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
190 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
191 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
193 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
197 cat-id-tbl.o: ../intl/libgettext.h
199 html dvi pdf ps info tags TAGS ID:
202 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
208 rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
209 rm -f SRC-POTFILES BLD-POTFILES
211 maintainer-clean: distclean
212 @echo "This command is intended for maintainers to use;"
213 @echo "it deletes files that may require special tools to rebuild."
214 rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in
216 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
217 dist distdir: update-po $(DISTFILES)
218 dists="$(DISTFILES)"; \
219 for file in $$dists; do \
220 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
221 || cp -p $(srcdir)/$$file $(distdir); \
225 $(MAKE) $(PACKAGE).pot
226 PATH=`pwd`/../src:$$PATH; \
228 catalogs='$(CATALOGS)'; \
229 for cat in $$catalogs; do \
230 cat=`basename $$cat`; \
231 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
232 mv $$lang.po $$lang.old.po; \
234 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
235 rm -f $$lang.old.po; \
237 echo "msgmerge for $$cat failed!"; \
239 mv $$lang.old.po $$lang.po; \
243 SRC-POTFILES: SRC-POTFILES.in
244 ( if test 'x$(srcdir)' != 'x.'; then \
245 posrcprefix='$(top_srcdir)/'; \
250 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
251 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
252 | sed -e '$$s/\\$$//') > $@-t \
256 BLD-POTFILES: BLD-POTFILES.in
258 && sed -e '/^#/d' -e '/^[ ]*$$/d' \
259 -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \
260 | sed -e '$$s/\\$$//' > $@-t \
264 SRC-POTFILES.in: @MAINT@ ../Makefile
265 cd .. && $(MAKE) po/SRC-POTFILES.in
267 BLD-POTFILES.in: @MAINT@ ../Makefile
268 cd .. && $(MAKE) po/BLD-POTFILES.in
270 Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES
272 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
273 CONFIG_HEADERS= $(SHELL) ./config.status
275 # Tell versions [3.59,3.63) of GNU make not to export all variables.
276 # Otherwise a system limit (for SysV at least) may be exceeded.