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=$(srcdir)/`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 --keyword=_ --keyword=N_ \
92 --files-from=$(srcdir)/POTFILES.in
93 rm -f $(srcdir)/$(PACKAGE).pot
94 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
96 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
97 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
99 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
100 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
101 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
104 echo cat-id-tbl.c changed; \
105 rm -f $(srcdir)/cat-id-tbl.c; \
106 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
108 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
111 install: install-exec install-data
115 install-data: install-data-@USE_NLS@
117 install-data-yes: all
118 if test -r $(MKINSTALLDIRS); then \
119 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
121 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
123 @catalogs='$(CATALOGS)'; \
124 for cat in $$catalogs; do \
125 cat=`basename $$cat`; \
127 *.gmo) destdir=$(gnulocaledir);; \
128 *) destdir=$(localedir);; \
130 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
131 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
132 if test -r $(MKINSTALLDIRS); then \
133 $(MKINSTALLDIRS) $$dir; \
135 $(top_srcdir)/mkinstalldirs $$dir; \
137 if test -r $$cat; then \
138 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
139 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
141 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
142 echo "installing $(srcdir)/$$cat as" \
143 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
145 if test -r $$cat.m; then \
146 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
147 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
149 if test -r $(srcdir)/$$cat.m ; then \
150 $(INSTALL_DATA) $(srcdir)/$$cat.m \
151 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
152 echo "installing $(srcdir)/$$cat as" \
153 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
159 if test "$(PACKAGE)" = "gettext"; then \
160 if test -r $(MKINSTALLDIRS); then \
161 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
163 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
165 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
166 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
171 # Define this as empty until I found a useful application.
175 catalogs='$(CATALOGS)'; \
176 for cat in $$catalogs; do \
177 cat=`basename $$cat`; \
178 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
179 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
180 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
181 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
182 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
184 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
188 cat-id-tbl.o: ../intl/libgettext.h
190 html dvi pdf ps info tags TAGS ID:
193 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
199 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
201 maintainer-clean: distclean
202 @echo "This command is intended for maintainers to use;"
203 @echo "it deletes files that may require special tools to rebuild."
206 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
207 dist distdir: update-po $(DISTFILES)
208 dists="$(DISTFILES)"; \
209 for file in $$dists; do \
210 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
211 || cp -p $(srcdir)/$$file $(distdir); \
215 $(MAKE) $(PACKAGE).pot
216 PATH=`pwd`/../src:$$PATH; \
218 catalogs='$(CATALOGS)'; \
219 for cat in $$catalogs; do \
220 cat=`basename $$cat`; \
221 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
222 mv $$lang.po $$lang.old.po; \
224 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
225 rm -f $$lang.old.po; \
227 echo "msgmerge for $$cat failed!"; \
229 mv $$lang.old.po $$lang.po; \
233 POTFILES: POTFILES.in
234 ( if test 'x$(srcdir)' != 'x.'; then \
235 posrcprefix='$(top_srcdir)/'; \
240 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
241 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
242 | sed -e '$$s/\\$$//') > $@-t \
246 POTFILES.in: @MAINT@ ../Makefile
247 cd .. && $(MAKE) po/POTFILES.in
249 Makefile: Make-in ../config.status POTFILES
251 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
252 CONFIG_HEADERS= $(SHELL) ./config.status
254 # Tell versions [3.59,3.63) of GNU make not to export all variables.
255 # Otherwise a system limit (for SysV at least) may be exceeded.