]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/Makefile.in
Initial revision
[thirdparty/gcc.git] / libiberty / Makefile.in
CommitLineData
6599da04
JM
1#
2# Makefile
3# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation
4#
5# This file is part of the libiberty library.
6# Libiberty is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Library General Public
8# License as published by the Free Software Foundation; either
9# version 2 of the License, or (at your option) any later version.
10#
11# Libiberty is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Library General Public License for more details.
15#
16# You should have received a copy of the GNU Library General Public
17# License along with libiberty; see the file COPYING.LIB. If not,
18# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19# Boston, MA 02111-1307, USA.
20#
21
22# This file was written, and is maintained by K. Richard Pixley
23# <rich@cygnus.com>.
24
25#
26# Makefile for libiberty directory
27#
28
29srcdir = .
30
31prefix = /usr/local
32
33exec_prefix = $(prefix)
34bindir = $(exec_prefix)/bin
35libdir = $(exec_prefix)/lib
36
37datadir = $(prefix)/share
38
39mandir = $(prefix)/man
40man1dir = $(mandir)/man1
41man2dir = $(mandir)/man2
42man3dir = $(mandir)/man3
43man4dir = $(mandir)/man4
44man5dir = $(mandir)/man5
45man6dir = $(mandir)/man6
46man7dir = $(mandir)/man7
47man8dir = $(mandir)/man8
48man9dir = $(mandir)/man9
49infodir = $(prefix)/info
50includedir = $(prefix)/include
51
52SHELL = /bin/sh
53
54# Multilib support variables.
55MULTISRCTOP =
56MULTIBUILDTOP =
57MULTIDIRS =
58MULTISUBDIR =
59MULTIDO = true
60MULTICLEAN = true
61
62INSTALL = install -c
63INSTALL_PROGRAM = $(INSTALL)
64INSTALL_DATA = $(INSTALL)
65
66AR = ar
67AR_FLAGS = rc
68
69ERRORS_CC = $(CC)
70CC = cc
71CFLAGS = -g
72LIBCFLAGS = $(CFLAGS)
73MAKEINFO = makeinfo
74RANLIB = ranlib
75
76PICFLAG =
77
78MAKEOVERRIDES =
79
80TARGETLIB = libiberty.a
81
82CONFIG_H = lconfig.h
83NEEDED_LIST = lneeded-list
84
85# HOST_OFILES contains the list of objects that should be in the
86# library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
87# A configuration may override this with a fixed list a object files
88# names (hard to maintain), or some other way to generate a list.
89HOST_OFILES=`cat needed-list`
90
91# Extra targets that the top-level target depends on.
92# Specifically, what needs to be made before HOST_OFILES can be used.
93# Can be empty if HOST_OFILES is just a list of file names.
94DO_ALSO = needed-list
95
96# A configuration can specify extra .o files that should be included,
97# even if they are in libc. (Perhaps the libc version is buggy.)
98EXTRA_OFILES =
99
100# Flags to pass to a recursive make.
101FLAGS_TO_PASS = \
102 "AR=$(AR)" \
103 "AR_FLAGS=$(AR_FLAGS)" \
104 "CC=$(CC)" \
105 "CFLAGS=$(CFLAGS)" \
106 "LIBCFLAGS=$(LIBCFLAGS)" \
107 "EXTRA_OFILES=$(EXTRA_OFILES)" \
108 "HDEFINES=$(HDEFINES)" \
109 "INSTALL=$(INSTALL)" \
110 "INSTALL_DATA=$(INSTALL_DATA)" \
111 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
112 "LDFLAGS=$(LDFLAGS)" \
113 "LOADLIBES=$(LOADLIBES)" \
114 "PICFLAG=$(PICFLAG)" \
115 "RANLIB=$(RANLIB)" \
116 "SHELL=$(SHELL)"
117
118all: stamp-picdir $(TARGETLIB) required-list
119 @if [ "$(RULE1)" != "not-used" ]; then \
120 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \
121 else true; \
122 fi
123
124.PHONY: check installcheck
125check installcheck:
126
127
128#### Host, target, and site specific Makefile fragments come in here.
129###
130
131INCDIR=$(srcdir)/$(MULTISRCTOP)../include
132
133COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
134.c.o:
135 test -z "$(PICFLAG)" || \
136 $(COMPILE.c) $(PICFLAG) $< -o pic/$@
137 $(COMPILE.c) $<
138
139# The default target just invokes make recursively.
140# However, the automatic configuration (in config/mh_default).
141# first causes it to figure out the objects missing in libc.
142info install-info clean-info dvi:
143
144# Include files that are in this directory.
145HFILES =
146
147# NOTE: If you add new files to the library, add them to this list
148# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
149CFILES = alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c bzero.c \
150 choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c fnmatch.c \
151 getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
152 floatformat.c hex.c index.c insque.c \
153 memchr.c memcmp.c memcpy.c memmove.c memset.c objalloc.c \
154 obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \
155 strcasecmp.c strncasecmp.c \
156 strchr.c strdup.c strerror.c strrchr.c strsignal.c \
157 strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
158 vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \
159 xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c
160# These are always included in the library.
161REQUIRED_OFILES = argv.o basename.o choose-temp.o concat.o cplus-dem.o \
162 fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \
163 floatformat.o objalloc.o obstack.o pexecute.o spaces.o strerror.o \
164 strsignal.o xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o
165
166# Do we want/need any config overrides?
167#
168
169STAGESTUFF = $(TARGETLIB) *.o
170
171INSTALL_DEST = libdir
172install: install_to_$(INSTALL_DEST)
173
174install_to_libdir: all
175 $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
176 ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
177 mv -f $(libdir)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
178 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
179
180install_to_tooldir: all
181 $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n
182 ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n )
183 mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
184 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
185
186# The default configuration adds to libiberty all those functions that are
187# missing in libc. More precisely, it includes whatever $(CC) fails to find.
188# Then a sed+awk combination translates the ld error messages into
189# a list of .o files.
190
191stamp-needed: stamp-picdir $(NEEDED_LIST)
192 cp $(NEEDED_LIST) needed-tmp
193 $(SHELL) $(srcdir)/../move-if-change needed-tmp needed-list
194 touch stamp-needed
195
196needed-list: stamp-needed ; @true
197
198lneeded-list: $(EXTRA_OFILES) needed.awk errors
199 rm -f lneeded-list
200 f=""; \
201 for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
202 case " $$f " in \
203 *" $$i "*) ;; \
204 *) f="$$f $$i" ;; \
205 esac ; \
206 done ; \
207 case $$f in \
208 *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \
209 esac ; \
210 echo $$f >>lneeded-list
211
212# Generate an awk script that looks for functions in functions.def
213
214needed.awk: $(srcdir)/functions.def Makefile
215 echo "# !Automatically generated from $(srcdir)/functions.def"\
216 "- DO NOT EDIT!" >needed.awk
217 grep '^DEF(' < $(srcdir)/functions.def \
218 | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
219 >>needed.awk
220
221stamp-config: $(CONFIG_H)
222 cp $(CONFIG_H) config.tmp
223 $(SHELL) $(srcdir)/../move-if-change config.tmp config.h
224 touch stamp-config
225
226config.h: stamp-config ; @true
227
228lconfig.h: needed2.awk errors
229 echo "/* !Automatically generated from $(srcdir)/functions.def"\
230 "- DO NOT EDIT! */" >lconfig.h
231 awk -f needed2.awk <errors >>lconfig.h
232
233# Generate an awk script that looks for variables in functions.def
234
235needed2.awk: $(srcdir)/functions.def Makefile
236 echo "# !Automatically generated from $(srcdir)/functions.def"\
237 "- DO NOT EDIT!" >needed2.awk
238 grep '^DEFVAR(' < $(srcdir)/functions.def \
239 | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
240 >>needed2.awk
241 grep '^DEFFUNC(' < $(srcdir)/functions.def \
242 | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
243 >>needed2.awk
244
245dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
246 $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null
247
248errors: dummy.o $(EXTRA_OFILES)
249 -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
250
251# required-list is used when building a shared bfd/opcodes/libiberty library.
252required-list: Makefile
253 echo $(REQUIRED_OFILES) > required-list
254
255$(HOST_OFILES) $(REQUIRED_OFILES) : config.h
256
257RULE1 = $(TARGETLIB)
258$(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
259 @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
260 "HOST_OFILES=$(HOST_OFILES)"
261
262# Rule invoked by recursive make in $(RULE1).
263RULE2 = not-used
264$(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
265 rm -rf $(TARGETLIB)
266 $(AR) $(AR_FLAGS) $(TARGETLIB) \
267 $(REQUIRED_OFILES) $(HOST_OFILES)
268 $(RANLIB) $(TARGETLIB)
269
270stamp-picdir:
271 if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
272 mkdir pic; \
273 else true; fi
274 touch stamp-picdir
275
276.always.:
277# Do nothing.
278
279.PHONY: all etags tags ls clean stage1 stage2 .always.
280
281etags tags: TAGS
282
283TAGS: $(CFILES) $(HFILES)
284 etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
285
286# The standalone demangler (c++filt) has been moved to binutils.
287demangle:
288 @echo "The standalone demangler, now named c++filt, is now"
289 @echo "a part of binutils."
290 @false
291
292ls:
293 @echo Makefile $(HFILES) $(CFILES)
294
295# Need to deal with profiled libraries, too.
296
297mostlyclean:
298 rm -rf *.o pic core errs \#* *.E a.out
299 rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
300 rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
301 @$(MULTICLEAN) multi-clean DO=mostlyclean
302clean: mostlyclean
303 rm -f *.a required-list tmpmulti.out
304 @$(MULTICLEAN) multi-clean DO=clean
305distclean: clean
306 rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS multilib.out
307 @$(MULTICLEAN) multi-clean DO=distclean
308maintainer-clean realclean: distclean
309
310force:
311
312Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
313 $(SHELL) ./config.status
314
315argv.o: $(INCDIR)/libiberty.h
316basename.o: $(INCDIR)/libiberty.h
317concat.o: $(INCDIR)/libiberty.h
318cplus-dem.o: $(INCDIR)/demangle.h
319fdmatch.o: $(INCDIR)/libiberty.h
320fnmatch.o: $(INCDIR)/fnmatch.h
321getopt.o: $(INCDIR)/getopt.h
322getopt1.o: $(INCDIR)/getopt.h
323getruntime.o: $(INCDIR)/libiberty.h
324hex.o: $(INCDIR)/libiberty.h
325floatformat.o: $(INCDIR)/floatformat.h
326objalloc.o: $(INCDIR)/objalloc.h
327obstack.o: $(INCDIR)/obstack.h
328pexecute.o: $(INCDIR)/libiberty.h
329spaces.o: $(INCDIR)/libiberty.h
330strerror.o: $(INCDIR)/libiberty.h
331strsignal.o: $(INCDIR)/libiberty.h
332xatexit.o: $(INCDIR)/libiberty.h
333xexit.o: $(INCDIR)/libiberty.h
334xmalloc.o: $(INCDIR)/libiberty.h
335xstrdup.o: $(INCDIR)/libiberty.h
336xstrerror.o: $(INCDIR)/libiberty.h