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 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 POTFILES.in $(PACKAGE).pot \
53 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
58 CATOBJEXT = @CATOBJEXT@
59 INSTOBJEXT = @INSTOBJEXT@
62 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
68 $(MAKE) $(PACKAGE).pot
69 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
75 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
76 && rm -f $$file && $(GMSGFMT) -o $$file $<
79 sed -f ../intl/po2msg.sed < $< > $*.msg \
80 && rm -f $@ && $(GENCAT) $@ $*.msg
85 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
88 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
89 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
90 --add-comments --keyword=_ --keyword=N_ \
91 --files-from=$(srcdir)/POTFILES.in
92 rm -f $(srcdir)/$(PACKAGE).pot
93 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
95 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
96 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
98 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
99 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
100 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
103 echo cat-id-tbl.c changed; \
104 rm -f $(srcdir)/cat-id-tbl.c; \
105 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
107 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
110 install: install-exec install-data
113 install-data: install-data-@USE_NLS@
115 install-data-yes: all
116 if test -r $(MKINSTALLDIRS); then \
117 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
119 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
121 @catalogs='$(CATALOGS)'; \
122 for cat in $$catalogs; do \
123 cat=`basename $$cat`; \
125 *.gmo) destdir=$(gnulocaledir);; \
126 *) destdir=$(localedir);; \
128 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
129 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
130 if test -r $(MKINSTALLDIRS); then \
131 $(MKINSTALLDIRS) $$dir; \
133 $(top_srcdir)/mkinstalldirs $$dir; \
135 if test -r $$cat; then \
136 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
137 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
139 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
140 echo "installing $(srcdir)/$$cat as" \
141 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
143 if test -r $$cat.m; then \
144 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
145 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
147 if test -r $(srcdir)/$$cat.m ; then \
148 $(INSTALL_DATA) $(srcdir)/$$cat.m \
149 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
150 echo "installing $(srcdir)/$$cat as" \
151 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
157 if test "$(PACKAGE)" = "gettext"; then \
158 if test -r $(MKINSTALLDIRS); then \
159 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
161 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
163 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
164 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
169 # Define this as empty until I found a useful application.
173 catalogs='$(CATALOGS)'; \
174 for cat in $$catalogs; do \
175 cat=`basename $$cat`; \
176 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
177 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
178 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
179 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
180 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
182 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
186 cat-id-tbl.o: ../intl/libgettext.h
188 dvi info tags TAGS ID:
191 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
197 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
199 maintainer-clean: distclean
200 @echo "This command is intended for maintainers to use;"
201 @echo "it deletes files that may require special tools to rebuild."
204 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
205 dist distdir: update-po $(DISTFILES)
206 dists="$(DISTFILES)"; \
207 for file in $$dists; do \
208 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
209 || cp -p $(srcdir)/$$file $(distdir); \
213 $(MAKE) $(PACKAGE).pot
214 PATH=`pwd`/../src:$$PATH; \
216 catalogs='$(CATALOGS)'; \
217 for cat in $$catalogs; do \
218 cat=`basename $$cat`; \
219 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
220 mv $$lang.po $$lang.old.po; \
222 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
223 rm -f $$lang.old.po; \
225 echo "msgmerge for $$cat failed!"; \
227 mv $$lang.old.po $$lang.po; \
231 POTFILES: POTFILES.in
232 ( if test 'x$(srcdir)' != 'x.'; then \
233 posrcprefix='$(top_srcdir)/'; \
238 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
239 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
240 | sed -e '$$s/\\$$//') > $@-t \
244 POTFILES.in: @MAINT@ ../Makefile
245 cd .. && $(MAKE) po/POTFILES.in
247 Makefile: Make-in ../config.status POTFILES
249 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
250 CONFIG_HEADERS= $(SHELL) ./config.status
252 # Tell versions [3.59,3.63) of GNU make not to export all variables.
253 # Otherwise a system limit (for SysV at least) may be exceeded.