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@
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 -C --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
114 install-data: install-data-@USE_NLS@
116 install-data-yes: all
117 if test -r $(MKINSTALLDIRS); then \
118 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
120 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
122 @catalogs='$(CATALOGS)'; \
123 for cat in $$catalogs; do \
124 cat=`basename $$cat`; \
126 *.gmo) destdir=$(gnulocaledir);; \
127 *) destdir=$(localedir);; \
129 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
130 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
131 if test -r $(MKINSTALLDIRS); then \
132 $(MKINSTALLDIRS) $$dir; \
134 $(top_srcdir)/mkinstalldirs $$dir; \
136 if test -r $$cat; then \
137 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
138 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
140 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
141 echo "installing $(srcdir)/$$cat as" \
142 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
144 if test -r $$cat.m; then \
145 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
146 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
148 if test -r $(srcdir)/$$cat.m ; then \
149 $(INSTALL_DATA) $(srcdir)/$$cat.m \
150 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
151 echo "installing $(srcdir)/$$cat as" \
152 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
158 if test "$(PACKAGE)" = "gettext"; then \
159 if test -r $(MKINSTALLDIRS); then \
160 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
162 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
164 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
165 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
170 # Define this as empty until I found a useful application.
174 catalogs='$(CATALOGS)'; \
175 for cat in $$catalogs; do \
176 cat=`basename $$cat`; \
177 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
178 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
179 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
180 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
181 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
183 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
187 cat-id-tbl.o: ../intl/libgettext.h
189 html dvi info tags TAGS ID:
192 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
198 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
200 maintainer-clean: distclean
201 @echo "This command is intended for maintainers to use;"
202 @echo "it deletes files that may require special tools to rebuild."
205 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
206 dist distdir: update-po $(DISTFILES)
207 dists="$(DISTFILES)"; \
208 for file in $$dists; do \
209 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
210 || cp -p $(srcdir)/$$file $(distdir); \
214 $(MAKE) $(PACKAGE).pot
215 PATH=`pwd`/../src:$$PATH; \
217 catalogs='$(CATALOGS)'; \
218 for cat in $$catalogs; do \
219 cat=`basename $$cat`; \
220 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
221 mv $$lang.po $$lang.old.po; \
223 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
224 rm -f $$lang.old.po; \
226 echo "msgmerge for $$cat failed!"; \
228 mv $$lang.old.po $$lang.po; \
232 POTFILES: POTFILES.in
233 ( if test 'x$(srcdir)' != 'x.'; then \
234 posrcprefix='$(top_srcdir)/'; \
239 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
240 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
241 | sed -e '$$s/\\$$//') > $@-t \
245 POTFILES.in: @MAINT@ ../Makefile
246 cd .. && $(MAKE) po/POTFILES.in
248 Makefile: Make-in ../config.status POTFILES
250 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
251 CONFIG_HEADERS= $(SHELL) ./config.status
253 # Tell versions [3.59,3.63) of GNU make not to export all variables.
254 # Otherwise a system limit (for SysV at least) may be exceeded.