1 # Makefile for program source directory in GNU NLS utilities package.
2 # Copyright (C) 1995, 1996 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 top_srcdir = @top_srcdir@
29 exec_prefix = @exec_prefix@
30 datadir = $(prefix)/@DATADIRNAME@
31 localedir = $(datadir)/locale
32 gnulocaledir = $(prefix)/share/locale
33 gettextsrcdir = $(prefix)/share/gettext
37 INSTALL_DATA = @INSTALL_DATA@
50 INCLUDES = -I.. -I$(top_srcdir)/intl
52 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
54 SOURCES = cat-id-tbl.c
57 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
58 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
63 CATOBJEXT = @CATOBJEXT@
64 INSTOBJEXT = @INSTOBJEXT@
67 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
73 $(MAKE) $(PACKAGE).pot
74 $(TUPDATE) $(srcdir)/$(PACKAGE).pot $< > $*.pox
80 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
81 && rm -f $$file && $(GMSGFMT) -o $$file $<
84 sed -f ../intl/po2msg.sed < $< > $*.msg \
85 && rm -f $@ && $(GENCAT) $@ $*.msg
90 all-yes: cat-id-tbl.c $(CATALOGS)
93 $(PACKAGE).pot: $(POTFILES)
94 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
95 --add-comments --keyword=_ --keyword=N_ \
96 --files-from=$(srcdir)/POTFILES.in
97 if cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \
98 rm -f $(PACKAGE).po; \
100 rm -f $(srcdir)/$(PACKAGE).pot \
101 && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; \
104 cat-id-tbl.c: stamp-cat-id
105 stamp-cat-id: $(PACKAGE).pot
106 rm -f cat-id-tbl.tmp.c
107 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
108 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp.c
109 if cmp -s cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; then \
110 rm cat-id-tbl.tmp.c; \
112 echo cat-id-tbl.c changed; \
113 rm -f $(srcdir)/cat-id-tbl.c; \
114 mv cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; \
116 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
119 install: install-exec install-data
122 $(top_srcdir)/mkinstalldirs $(datadir)
123 catalogs='$(CATALOGS)'; \
124 for cat in $$catalogs; do \
126 *.gmo) destdir=$(gnulocaledir);; \
127 *) destdir=$(localedir);; \
129 lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
130 dir=$$destdir/$$lang/LC_MESSAGES; \
131 $(top_srcdir)/mkinstalldirs $$dir; \
132 if test -r $$cat; then \
133 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
135 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
139 # This installation goal is only used in GNU gettext. Packages which
140 # only use the library should use install instead.
142 $(top_srcdir)/mkinstalldirs $(gettextsrcdir)
144 $(INSTALL_DATA) Makefile.in.in $(gettextsrcdir)/po-Makefile.in.in
147 catalogs='$(CATALOGS)'; \
148 for cat in $$catalogs; do \
149 lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
150 rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
151 rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
153 rm -f $(gettextsrcdir)/po-Makefile.in.in
157 cat-id-tbl.o: ../intl/libgettext.h
162 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp.c
168 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat
170 maintainer-clean: distclean
171 @echo "This command is intended for maintainers to use;"
172 @echo "it deletes files that may require special tools to rebuild."
174 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
175 dist dist-gettext: update-po $(DISTFILES)
176 for file in $(DISTFILES); do \
177 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
178 || cp -p $(srcdir)/$$file $(distdir); \
182 $(MAKE) $(PACKAGE).pot
184 catalogs='$(CATALOGS)'; \
185 for cat in $$catalogs; do \
186 lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
187 mv $$lang.po $$lang.old.po; \
188 if $(TUPDATE) $(PACKAGE).pot $$lang.old.po > $$lang.po; then \
189 rm -f $$lang.old.po; \
191 echo "tupdate for $$cat failed!"; \
193 mv $$lang.old.po $$lang.po; \
197 POTFILES: POTFILES.in
198 ( if test 'x$(srcdir)' != 'x.'; then \
199 posrcprefix='$(top_srcdir)/'; \
203 sed -e '/^#/d' -e '/^[ ]*$$/d' \
204 -e "s@.*@ $$posrcprefix& \\\\@" \
205 -e '$$s/\(.*\) \\/\1/' < $(srcdir)/POTFILES.in > POTFILES )
207 Makefile: Makefile.in.in ../config.status POTFILES
209 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
210 $(SHELL) ./config.status
212 # Tell versions [3.59,3.63) of GNU make not to export all variables.
213 # Otherwise a system limit (for SysV at least) may be exceeded.