Commit | Line | Data |
---|---|---|
252b5132 RH |
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 | # | |
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 | ||
9 | PACKAGE = @PACKAGE@ | |
10 | VERSION = @VERSION@ | |
11 | ||
12 | SHELL = /bin/sh | |
13 | @SET_MAKE@ | |
14 | ||
15 | srcdir = @srcdir@ | |
16 | top_srcdir = @top_srcdir@ | |
17 | VPATH = @srcdir@ | |
18 | ||
19 | prefix = @prefix@ | |
20 | exec_prefix = @exec_prefix@ | |
21 | datadir = $(prefix)/@DATADIRNAME@ | |
22 | localedir = $(datadir)/locale | |
23 | gnulocaledir = $(prefix)/share/locale | |
24 | gettextsrcdir = $(prefix)/share/gettext/po | |
25 | subdir = po | |
26 | ||
27 | INSTALL = @INSTALL@ | |
28 | INSTALL_DATA = @INSTALL_DATA@ | |
29 | MKINSTALLDIRS = @MKINSTALLDIRS@ | |
30 | ||
31 | CC = @CC@ | |
32 | GENCAT = @GENCAT@ | |
33 | GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ | |
34 | MSGFMT = @MSGFMT@ | |
35 | XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ | |
36 | MSGMERGE = PATH=../src:$$PATH msgmerge | |
37 | ||
38 | DEFS = @DEFS@ | |
39 | CFLAGS = @CFLAGS@ | |
40 | CPPFLAGS = @CPPFLAGS@ | |
41 | ||
42 | INCLUDES = -I.. -I$(top_srcdir)/intl | |
43 | ||
44 | COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) | |
45 | ||
46 | SOURCES = cat-id-tbl.c | |
47 | POFILES = @POFILES@ | |
48 | GMOFILES = @GMOFILES@ | |
55c80943 | 49 | DISTFILES = ChangeLog Makefile.in.in SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \ |
252b5132 RH |
50 | stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES) |
51 | ||
55c80943 NC |
52 | # Note - the following line gets processed by bfd/configure and amended |
53 | # to contain the full list of source dir POTFILES. | |
54 | SRC-POTFILES = \ | |
55 | ||
56 | # Note - the following line gets processed by bfd/configure and amended | |
57 | # to contain the full list of build dir POTFILES. | |
58 | BLD-POTFILES = \ | |
252b5132 RH |
59 | |
60 | CATALOGS = @CATALOGS@ | |
61 | CATOBJEXT = @CATOBJEXT@ | |
62 | INSTOBJEXT = @INSTOBJEXT@ | |
63 | ||
64 | .SUFFIXES: | |
65 | .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat | |
66 | ||
67 | .c.o: | |
68 | $(COMPILE) $< | |
69 | ||
70 | .po.pox: | |
71 | $(MAKE) $(PACKAGE).pot | |
72 | $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox | |
73 | ||
74 | .po.mo: | |
75 | $(MSGFMT) -o $@ $< | |
76 | ||
77 | .po.gmo: | |
78 | file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ | |
79 | && rm -f $$file && $(GMSGFMT) -o $$file $< | |
80 | ||
81 | .po.cat: | |
82 | sed -f ../intl/po2msg.sed < $< > $*.msg \ | |
83 | && rm -f $@ && $(GENCAT) $@ $*.msg | |
84 | ||
85 | ||
86 | all: all-@USE_NLS@ | |
87 | ||
88 | all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot | |
89 | all-no: | |
90 | ||
55c80943 NC |
91 | $(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES) |
92 | $(XGETTEXT) --default-domain=$(PACKAGE) \ | |
93 | --directory=$(top_srcdir) \ | |
94 | --add-comments --keyword=_ --keyword=N_ \ | |
95 | --files-from=$(srcdir)/SRC-POTFILES.in | |
96 | $(XGETTEXT) --default-domain=$(PACKAGE) \ | |
97 | --directory=.. \ | |
98 | --directory=. \ | |
252b5132 | 99 | --add-comments --keyword=_ --keyword=N_ \ |
55c80943 NC |
100 | --join-existing \ |
101 | --files-from=$(srcdir)/BLD-POTFILES.in | |
252b5132 RH |
102 | rm -f $(srcdir)/$(PACKAGE).pot |
103 | mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot | |
104 | ||
105 | $(srcdir)/cat-id-tbl.c: stamp-cat-id; @: | |
106 | $(srcdir)/stamp-cat-id: $(PACKAGE).pot | |
107 | rm -f cat-id-tbl.tmp | |
108 | sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ | |
109 | | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp | |
110 | if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ | |
111 | rm cat-id-tbl.tmp; \ | |
112 | else \ | |
113 | echo cat-id-tbl.c changed; \ | |
114 | rm -f $(srcdir)/cat-id-tbl.c; \ | |
115 | mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ | |
116 | fi | |
117 | cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id | |
118 | ||
119 | ||
120 | install: install-exec install-data | |
121 | install-exec: | |
122 | install-info: | |
123 | install-data: install-data-@USE_NLS@ | |
124 | install-data-no: all | |
125 | install-data-yes: all | |
126 | if test -r $(MKINSTALLDIRS); then \ | |
127 | $(MKINSTALLDIRS) $(datadir); \ | |
128 | else \ | |
129 | $(top_srcdir)/mkinstalldirs $(datadir); \ | |
130 | fi | |
131 | @catalogs='$(CATALOGS)'; \ | |
132 | for cat in $$catalogs; do \ | |
133 | cat=`basename $$cat`; \ | |
134 | case "$$cat" in \ | |
135 | *.gmo) destdir=$(gnulocaledir);; \ | |
136 | *) destdir=$(localedir);; \ | |
137 | esac; \ | |
138 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ | |
139 | dir=$$destdir/$$lang/LC_MESSAGES; \ | |
140 | if test -r $(MKINSTALLDIRS); then \ | |
141 | $(MKINSTALLDIRS) $$dir; \ | |
142 | else \ | |
143 | $(top_srcdir)/mkinstalldirs $$dir; \ | |
144 | fi; \ | |
145 | if test -r $$cat; then \ | |
146 | $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ | |
147 | echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ | |
148 | else \ | |
149 | $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ | |
150 | echo "installing $(srcdir)/$$cat as" \ | |
151 | "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ | |
152 | fi; \ | |
153 | if test -r $$cat.m; then \ | |
154 | $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ | |
155 | echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ | |
156 | else \ | |
157 | if test -r $(srcdir)/$$cat.m ; then \ | |
158 | $(INSTALL_DATA) $(srcdir)/$$cat.m \ | |
159 | $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ | |
160 | echo "installing $(srcdir)/$$cat as" \ | |
161 | "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ | |
162 | else \ | |
163 | true; \ | |
164 | fi; \ | |
165 | fi; \ | |
166 | done | |
167 | if test "$(PACKAGE)" = "gettext"; then \ | |
168 | if test -r $(MKINSTALLDIRS); then \ | |
169 | $(MKINSTALLDIRS) $(gettextsrcdir); \ | |
170 | else \ | |
171 | $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ | |
172 | fi; \ | |
173 | $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ | |
174 | $(gettextsrcdir)/Makefile.in.in; \ | |
175 | else \ | |
176 | : ; \ | |
177 | fi | |
178 | ||
179 | # Define this as empty until I found a useful application. | |
180 | installcheck: | |
181 | ||
182 | uninstall: | |
183 | catalogs='$(CATALOGS)'; \ | |
184 | for cat in $$catalogs; do \ | |
185 | cat=`basename $$cat`; \ | |
186 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ | |
187 | rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ | |
188 | rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ | |
189 | rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ | |
190 | rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ | |
191 | done | |
192 | rm -f $(gettextsrcdir)/po-Makefile.in.in | |
193 | ||
194 | check: all | |
195 | ||
196 | cat-id-tbl.o: ../intl/libgettext.h | |
197 | ||
198 | dvi info tags TAGS ID: | |
199 | ||
200 | mostlyclean: | |
201 | rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp | |
202 | rm -fr *.o | |
203 | ||
204 | clean: mostlyclean | |
205 | ||
206 | distclean: clean | |
55c80943 NC |
207 | rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m |
208 | rm -f SRC-POTFILES BLD-POTFILES SRC-POTFILES.in BLD-POTFILES.in | |
209 | ||
252b5132 RH |
210 | maintainer-clean: distclean |
211 | @echo "This command is intended for maintainers to use;" | |
212 | @echo "it deletes files that may require special tools to rebuild." | |
213 | rm -f $(GMOFILES) | |
214 | ||
215 | distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) | |
216 | dist distdir: update-po $(DISTFILES) | |
217 | dists="$(DISTFILES)"; \ | |
218 | for file in $$dists; do \ | |
219 | ln $(srcdir)/$$file $(distdir) 2> /dev/null \ | |
220 | || cp -p $(srcdir)/$$file $(distdir); \ | |
221 | done | |
222 | ||
223 | update-po: Makefile | |
224 | $(MAKE) $(PACKAGE).pot | |
225 | PATH=`pwd`/../src:$$PATH; \ | |
226 | cd $(srcdir); \ | |
227 | catalogs='$(CATALOGS)'; \ | |
228 | for cat in $$catalogs; do \ | |
229 | cat=`basename $$cat`; \ | |
230 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ | |
231 | mv $$lang.po $$lang.old.po; \ | |
232 | echo "$$lang:"; \ | |
233 | if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ | |
234 | rm -f $$lang.old.po; \ | |
235 | else \ | |
236 | echo "msgmerge for $$cat failed!"; \ | |
237 | rm -f $$lang.po; \ | |
238 | mv $$lang.old.po $$lang.po; \ | |
239 | fi; \ | |
240 | done | |
241 | ||
55c80943 | 242 | SRC-POTFILES: SRC-POTFILES.in |
252b5132 RH |
243 | ( if test 'x$(srcdir)' != 'x.'; then \ |
244 | posrcprefix='$(top_srcdir)/'; \ | |
245 | else \ | |
246 | posrcprefix="../"; \ | |
247 | fi; \ | |
248 | rm -f $@-t $@ \ | |
55c80943 NC |
249 | && (sed -e '/^#/d' \ |
250 | -e '/^[ ]*$$/d' \ | |
252b5132 RH |
251 | -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ |
252 | | sed -e '$$s/\\$$//') > $@-t \ | |
253 | && chmod a-w $@-t \ | |
254 | && mv $@-t $@ ) | |
255 | ||
55c80943 NC |
256 | BLD-POTFILES: BLD-POTFILES.in |
257 | ( rm -f $@-t $@ \ | |
258 | && (sed -e '/^#/d' \ | |
259 | -e '/^[ ]*$$/d' \ | |
260 | -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \ | |
261 | | sed -e '$$s/\\$$//') > $@-t \ | |
262 | && chmod a-w $@-t \ | |
263 | && mv $@-t $@ ) | |
264 | ||
265 | SRC-POTFILES.in: @MAINT@ ../Makefile | |
266 | cd .. && $(MAKE) po/SRC-POTFILES.in | |
252b5132 | 267 | |
55c80943 NC |
268 | BLD-POTFILES.in: @MAINT@ ../Makefile |
269 | cd .. && $(MAKE) po/BLD-POTFILES.in | |
270 | ||
271 | # Note - The presence of SRC-POTFILES and BLD-POTFILES as dependencies | |
272 | # here breaks the implementation of the 'distclean' rule for maintainers. | |
273 | # This is because if 'make distclean' is run in the BFD directory, the | |
274 | # Makefile there will be deleted before 'distclean' is made here, and so | |
275 | # the dependency SRC-POTFILES -> SRC-POTFILES.in -> ../Makefile cannot | |
276 | # be satisfied. | |
277 | # | |
278 | # The SRC-POTFILES and BLD-POTFILES dependencies cannot be removed, | |
279 | # however since it is necessary that these files be built during | |
280 | # *configure* time, so that configure can insert them into the | |
281 | # po/Makefile that it is creating, so that the Makefile will have | |
282 | # the correct dependencies. | |
283 | Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES | |
252b5132 RH |
284 | cd .. \ |
285 | && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \ | |
286 | CONFIG_HEADERS= $(SHELL) ./config.status | |
287 | ||
288 | # Tell versions [3.59,3.63) of GNU make not to export all variables. | |
289 | # Otherwise a system limit (for SysV at least) may be exceeded. | |
290 | .NOEXPORT: |