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