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>
4 # This file file be copied and used freely without restrictions. It can
5 # be used in projects which are not available under the GNU Public License
6 # but which still want to provide support for the GNU gettext functionality.
7 # Please note that the actual code is *not* freely available.
16 top_srcdir = @top_srcdir@
20 exec_prefix = @exec_prefix@
21 datadir = $(prefix)/@DATADIRNAME@
22 localedir = $(datadir)/locale
23 gnulocaledir = $(prefix)/share/locale
24 gettextsrcdir = $(prefix)/share/gettext/po
28 INSTALL_DATA = @INSTALL_DATA@
29 MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
33 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
35 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
36 MSGMERGE = PATH=../src:$$PATH msgmerge
42 INCLUDES = -I.. -I$(top_srcdir)/intl
44 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
46 SOURCES = cat-id-tbl.c
49 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
50 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
55 CATOBJEXT = @CATOBJEXT@
56 INSTOBJEXT = @INSTOBJEXT@
59 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
65 $(MAKE) $(PACKAGE).pot
66 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
72 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
73 && rm -f $$file && $(GMSGFMT) -o $$file $<
76 sed -f ../intl/po2msg.sed < $< > $*.msg \
77 && rm -f $@ && $(GENCAT) $@ $*.msg
82 all-yes: cat-id-tbl.c $(CATALOGS)
85 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
86 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
87 --add-comments --keyword=_ --keyword=N_ \
88 --files-from=$(srcdir)/POTFILES.in \
89 && test ! -f $(PACKAGE).po \
90 || ( rm -f $(srcdir)/$(PACKAGE).pot \
91 && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
93 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
94 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
96 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
97 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
98 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
101 echo cat-id-tbl.c changed; \
102 rm -f $(srcdir)/cat-id-tbl.c; \
103 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
105 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
108 install: install-exec install-data
110 install-data: install-data-@USE_NLS@
112 install-data-yes: all
113 if test -r "$(MKINSTALLDIRS)"; then \
114 $(MKINSTALLDIRS) $(DESTDIR)/$(datadir); \
116 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir); \
118 @catalogs='$(CATALOGS)'; \
119 for cat in $$catalogs; do \
120 cat=`basename $$cat`; \
122 *.gmo) destdir=$(gnulocaledir);; \
123 *) destdir=$(localedir);; \
125 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
126 dir=$$destdir/$$lang/LC_MESSAGES; \
127 if test -r "$(MKINSTALLDIRS)"; then \
128 $(MKINSTALLDIRS) $(DESTDIR)/$$dir; \
130 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)/$$dir; \
132 if test -r $$cat; then \
133 $(INSTALL_DATA) $$cat $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT); \
134 echo "installing $$cat as $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
136 $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT); \
137 echo "installing $(srcdir)/$$cat as" \
138 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
140 if test -r $$cat.m; then \
141 $(INSTALL_DATA) $$cat.m $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
142 echo "installing $$cat.m as $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
144 if test -r $(srcdir)/$$cat.m ; then \
145 $(INSTALL_DATA) $(srcdir)/$$cat.m \
146 $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
147 echo "installing $(srcdir)/$$cat as" \
148 "$(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
154 if test "$(PACKAGE)" = "gettext"; then \
155 if test -r "$(MKINSTALLDIRS)"; then \
156 $(MKINSTALLDIRS) $(DESTDIR)/$(gettextsrcdir); \
158 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(gettextsrcdir); \
160 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
161 $(DESTDIR)/$(gettextsrcdir)/Makefile.in.in; \
166 # Define this as empty until I found a useful application.
170 catalogs='$(CATALOGS)'; \
171 for cat in $$catalogs; do \
172 cat=`basename $$cat`; \
173 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
174 rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
175 rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
176 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
177 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
179 rm -f $(gettextsrcdir)/po-Makefile.in.in
183 cat-id-tbl.o: ../intl/libgettext.h
185 dvi info tags TAGS ID:
188 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
194 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
196 maintainer-clean: distclean
197 @echo "This command is intended for maintainers to use;"
198 @echo "it deletes files that may require special tools to rebuild."
201 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
202 dist distdir: update-po $(DISTFILES)
203 dists="$(DISTFILES)"; \
204 for file in $$dists; do \
205 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
206 || cp -p $(srcdir)/$$file $(distdir); \
210 $(MAKE) $(PACKAGE).pot
211 PATH=`pwd`/../src:$$PATH; \
213 catalogs='$(CATALOGS)'; \
214 for cat in $$catalogs; do \
215 cat=`basename $$cat`; \
216 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
217 mv $$lang.po $$lang.old.po; \
219 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
220 rm -f $$lang.old.po; \
222 echo "msgmerge for $$cat failed!"; \
224 mv $$lang.old.po $$lang.po; \
228 POTFILES: POTFILES.in
229 ( if test 'x$(srcdir)' != 'x.'; then \
230 posrcprefix='$(top_srcdir)/'; \
235 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
236 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
237 | sed -e '$$s/\\$$//') > $@-t \
241 Makefile: Makefile.in.in ../config.status POTFILES
243 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
244 $(SHELL) ./config.status
246 # Tell versions [3.59,3.63) of GNU make not to export all variables.
247 # Otherwise a system limit (for SysV at least) may be exceeded.