OSDN Git Service

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