blob: 111b40fcbb6664771b9f09c3cd91fff9dccffe75 [file] [log] [blame]
Theodore Ts'o5bc5a892000-02-08 20:20:46 +00001# 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#
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.
8
9PACKAGE = @PACKAGE@
10VERSION = @VERSION@
11
12SHELL = /bin/sh
13@SET_MAKE@
14
15srcdir = @srcdir@
16top_srcdir = @top_srcdir@
17VPATH = @srcdir@
18
19prefix = @prefix@
20exec_prefix = @exec_prefix@
21datadir = $(prefix)/@DATADIRNAME@
22localedir = $(datadir)/locale
23gnulocaledir = $(prefix)/share/locale
24gettextsrcdir = $(prefix)/share/gettext/po
25subdir = po
26
27INSTALL = @INSTALL@
28INSTALL_DATA = @INSTALL_DATA@
29MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
30
31CC = @CC@
32GENCAT = @GENCAT@
33GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
34MSGFMT = @MSGFMT@
35XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
36MSGMERGE = PATH=../src:$$PATH msgmerge
37
38DEFS = @DEFS@
39CFLAGS = @CFLAGS@
40CPPFLAGS = @CPPFLAGS@
41
42INCLUDES = -I.. -I$(top_srcdir)/intl
43
44COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
45
46SOURCES = cat-id-tbl.c
47POFILES = @POFILES@
48GMOFILES = @GMOFILES@
49DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
50stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
51
52POTFILES = \
53
54CATALOGS = @CATALOGS@
55CATOBJEXT = @CATOBJEXT@
56INSTOBJEXT = @INSTOBJEXT@
57
58.SUFFIXES:
59.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
60
61.c.o:
62 $(COMPILE) $<
63
64.po.pox:
65 $(MAKE) $(PACKAGE).pot
66 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
67
68.po.mo:
69 $(MSGFMT) -o $@ $<
70
71.po.gmo:
72 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
73 && rm -f $$file && $(GMSGFMT) -o $$file $<
74
75.po.cat:
76 sed -f ../intl/po2msg.sed < $< > $*.msg \
77 && rm -f $@ && $(GENCAT) $@ $*.msg
78
79
80all: all-@USE_NLS@
81
82all-yes: cat-id-tbl.c $(CATALOGS)
83all-no:
84
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 )
92
93$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
94$(srcdir)/stamp-cat-id: $(PACKAGE).pot
95 rm -f cat-id-tbl.tmp
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 \
99 rm cat-id-tbl.tmp; \
100 else \
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; \
104 fi
105 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
106
107
108install: install-exec install-data
109install-exec:
110install-data: install-data-@USE_NLS@
111install-data-no: all
112install-data-yes: all
113 if test -r "$(MKINSTALLDIRS)"; then \
114 $(MKINSTALLDIRS) $(datadir); \
115 else \
116 $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
117 fi
118 @catalogs='$(CATALOGS)'; \
119 for cat in $$catalogs; do \
120 cat=`basename $$cat`; \
121 case "$$cat" in \
122 *.gmo) destdir=$(gnulocaledir);; \
123 *) destdir=$(localedir);; \
124 esac; \
125 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
126 dir=$$destdir/$$lang/LC_MESSAGES; \
127 if test -r "$(MKINSTALLDIRS)"; then \
128 $(MKINSTALLDIRS) $$dir; \
129 else \
130 $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
131 fi; \
132 if test -r $$cat; then \
133 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
134 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
135 else \
136 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
137 echo "installing $(srcdir)/$$cat as" \
138 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
139 fi; \
140 if test -r $$cat.m; then \
141 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
142 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
143 else \
144 if test -r $(srcdir)/$$cat.m ; then \
145 $(INSTALL_DATA) $(srcdir)/$$cat.m \
146 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
147 echo "installing $(srcdir)/$$cat as" \
148 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
149 else \
150 true; \
151 fi; \
152 fi; \
153 done
154 if test "$(PACKAGE)" = "gettext"; then \
155 if test -r "$(MKINSTALLDIRS)"; then \
156 $(MKINSTALLDIRS) $(gettextsrcdir); \
157 else \
158 $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
159 fi; \
160 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
161 $(gettextsrcdir)/Makefile.in.in; \
162 else \
163 : ; \
164 fi
165
166# Define this as empty until I found a useful application.
167installcheck:
168
169uninstall:
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; \
178 done
179 rm -f $(gettextsrcdir)/po-Makefile.in.in
180
181check: all
182
183cat-id-tbl.o: ../intl/libgettext.h
184
185dvi info tags TAGS ID:
186
187mostlyclean:
188 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
189 rm -fr *.o
190
191clean: mostlyclean
192
193distclean: clean
194 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
195
196maintainer-clean: distclean
197 @echo "This command is intended for maintainers to use;"
198 @echo "it deletes files that may require special tools to rebuild."
199 rm -f $(GMOFILES)
200
201distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
202dist 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); \
207 done
208
209update-po: Makefile
210 $(MAKE) $(PACKAGE).pot
211 PATH=`pwd`/../src:$$PATH; \
212 cd $(srcdir); \
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; \
218 echo "$$lang:"; \
219 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
220 rm -f $$lang.old.po; \
221 else \
222 echo "msgmerge for $$cat failed!"; \
223 rm -f $$lang.po; \
224 mv $$lang.old.po $$lang.po; \
225 fi; \
226 done
227
228POTFILES: POTFILES.in
229 ( if test 'x$(srcdir)' != 'x.'; then \
230 posrcprefix='$(top_srcdir)/'; \
231 else \
232 posrcprefix="../"; \
233 fi; \
234 rm -f $@-t $@ \
235 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
236 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
237 | sed -e '$$s/\\$$//') > $@-t \
238 && chmod a-w $@-t \
239 && mv $@-t $@ )
240
241Makefile: Makefile.in.in ../config.status POTFILES
242 cd .. \
243 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
244 $(SHELL) ./config.status
245
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.
248.NOEXPORT: