3 # Copyright (C) 1990, 91-99, 2000, 2001
4 # Free Software Foundation
6 # This file is part of the libiberty library.
7 # Libiberty is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Library General Public
9 # License as published by the Free Software Foundation; either
10 # version 2 of the License, or (at your option) any later version.
12 # Libiberty is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Library General Public License for more details.
17 # You should have received a copy of the GNU Library General Public
18 # License along with libiberty; see the file COPYING.LIB. If not,
19 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 # Boston, MA 02111-1307, USA.
23 # This file was written by K. Richard Pixley <rich@cygnus.com>.
26 # Makefile for libiberty directory
34 exec_prefix = @exec_prefix@
40 # Multilib support variables.
49 INSTALL_PROGRAM = @INSTALL_PROGRAM@
50 INSTALL_DATA = @INSTALL_DATA@
66 TARGETLIB = libiberty.a
70 # A configuration can specify extra .o files that should be included,
71 # even if they are in libc. (Perhaps the libc version is buggy.)
74 # Flags to pass to a recursive make.
77 "AR_FLAGS=$(AR_FLAGS)" \
80 "LIBCFLAGS=$(LIBCFLAGS)" \
81 "EXTRA_OFILES=$(EXTRA_OFILES)" \
82 "HDEFINES=$(HDEFINES)" \
83 "INSTALL=$(INSTALL)" \
84 "INSTALL_DATA=$(INSTALL_DATA)" \
85 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
86 "LDFLAGS=$(LDFLAGS)" \
87 "LOADLIBES=$(LOADLIBES)" \
91 "exec_prefix=$(exec_prefix)" \
93 "libsubdir=$(libsubdir)" \
96 # Subdirectories to recurse into. We need to override this during cleaning
99 # FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
100 all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
101 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
103 .PHONY: check installcheck
105 installcheck: installcheck-subdir
109 INCDIR=$(srcdir)/$(MULTISRCTOP)../include
111 COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
113 if [ x"$(PICFLAG)" != x ]; then \
114 $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
118 # NOTE: If you add new files to the library, add them to this list
119 # (alphabetical), and add them to REQUIRED_OFILES or funcs in
121 CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \
122 bsearch.c bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c \
123 cp-demangle.c dyn-string.c fdmatch.c fnmatch.c ffs.c getcwd.c \
124 getpwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
125 floatformat.c hashtab.c hex.c index.c insque.c lbasename.c \
126 md5.c make-temp-file.c memchr.c \
127 memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c \
128 partition.c pexecute.c putenv.c random.c \
129 regex.c rename.c rindex.c setenv.c \
130 sigsetmask.c safe-ctype.c sort.c spaces.c splay-tree.c strcasecmp.c \
131 strncasecmp.c strchr.c strdup.c strerror.c strncmp.c strrchr.c \
132 strsignal.c strstr.c strtod.c strtol.c strtoul.c tmpnam.c vasprintf.c \
133 vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c xatexit.c xexit.c \
134 xmalloc.c xmemdup.c xstrdup.c xstrerror.c ternary.c fibheap.c
136 # These are always included in the library.
137 REQUIRED_OFILES = argv.o alloca.o choose-temp.o concat.o cplus-dem.o \
138 cp-demangle.o dyn-string.o fdmatch.o fnmatch.o getopt.o getopt1.o \
139 getpwd.o getruntime.o hashtab.o hex.o floatformat.o lbasename.o \
140 md5.o make-temp-file.o objalloc.o \
141 obstack.o partition.o pexecute.o regex.o safe-ctype.o sort.o spaces.o \
142 splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \
143 xmemdup.o xstrdup.o xstrerror.o ternary.o fibheap.o
145 # These are all the objects that configure may add to the library via
146 # $funcs. This list exists here only for "make maint-missing".
147 CONFIGURED_OFILES = asprintf.o atexit.o basename.o bcmp.o bcopy.o \
148 bsearch.o bzero.o calloc.o clock.o ffs.o getcwd.o \
149 getpagesize.o index.o insque.o memchr.o memcmp.o memcpy.o \
150 memmove.o memset.o mkstemps.o putenv.o random.o rename.o \
151 rindex.o setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \
152 strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \
153 strtoul.o tmpnam.o vasprintf.o vfork.o vfprintf.o vprintf.o \
156 $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
157 -rm -f $(TARGETLIB) pic/$(TARGETLIB)
158 $(AR) $(AR_FLAGS) $(TARGETLIB) \
159 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
160 $(RANLIB) $(TARGETLIB)
161 if [ x"$(PICFLAG)" != x ]; then \
163 $(AR) $(AR_FLAGS) $(TARGETLIB) \
164 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
165 $(RANLIB) $(TARGETLIB); \
169 info: libiberty.info info-subdir
170 install-info: install-info-subdir
171 clean-info: clean-info-subdir
172 dvi: libiberty.dvi dvi-subdir
176 $(srcdir)/libiberty.texi \
177 $(srcdir)/copying-lib.texi \
178 $(srcdir)/obstacks.texi \
179 $(srcdir)/functions.texi
181 # Additional files that have texi snippets that need to be collected
182 # and sorted. Some are here because the sources are imported from
183 # elsewhere. Others represent headers in ../include.
184 TEXIFILES = fnmatch.txh
186 libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
187 $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
189 libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC)
190 texi2dvi $(srcdir)/libiberty.texi
192 libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
193 $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi
195 @MAINT@$(srcdir)/functions.texi : stamp-functions
198 @MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile
199 @MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
200 @MAINT@ echo stamp > stamp-functions
202 INSTALL_DEST = @INSTALL_DEST@
203 install: install_to_$(INSTALL_DEST) install-subdir
205 install_to_libdir: all
206 $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
207 ( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
208 mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
209 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
211 install_to_tooldir: all
212 $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
213 ( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
214 mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
215 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
217 # needed-list is used by libstdc++. NEEDED is the list of functions
218 # to include there. Do not add anything LGPL to this list; libstdc++
219 # can't use anything encumbering.
220 NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
221 strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
222 vfork waitpid bcmp bcopy bzero
223 needed-list: Makefile
224 rm -f needed-list; touch needed-list; \
225 for f in $(NEEDED); do \
226 for g in $(LIBOBJS) $(EXTRA_OFILES); do \
228 *$$f*) echo $$g >> needed-list ;; \
233 # required-list was used when building a shared bfd/opcodes/libiberty
234 # library. I don't know if it used by anything currently.
235 required-list: Makefile
236 echo $(REQUIRED_OFILES) > required-list
239 if [ x"$(PICFLAG)" != x ] && [ ! -d pic ]; then \
244 .PHONY: all etags tags ls clean stage1 stage2
246 etags tags: TAGS etags-subdir
249 etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done`
251 # The standalone demangler (c++filt) has been moved to binutils.
253 @echo "The standalone demangler, now named c++filt, is now"
254 @echo "a part of binutils."
258 @echo Makefile $(CFILES)
260 # Various targets for maintainers.
263 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
265 maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
268 maint-undoc : $(srcdir)/functions.texi
269 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc
271 # Need to deal with profiled libraries, too.
273 # Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
274 # multiple times, hence our explicit recursion with an empty SUBDIRS.
275 mostlyclean: mostlyclean-subdir
276 -rm -rf *.o pic core errs \#* *.E a.out
277 -rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
278 -rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
279 -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky
280 -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
281 -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr
283 @$(MULTICLEAN) multi-clean DO=mostlyclean
285 $(MAKE) SUBDIRS="" mostlyclean
286 -rm -f *.a required-list tmpmulti.out
287 -rm -f libiberty.dvi libiberty.info* libiberty.html
288 @$(MULTICLEAN) multi-clean DO=clean
289 distclean: distclean-subdir
290 $(MAKE) SUBDIRS="" clean
291 @$(MULTICLEAN) multi-clean DO=distclean
292 -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
294 -rmdir testsuite 2>/dev/null
295 maintainer-clean realclean: maintainer-clean-subdir
296 $(MAKE) SUBDIRS="" distclean
300 Makefile: $(srcdir)/Makefile.in config.status
301 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
303 # Depending on Makefile makes sure that config.status has been re-run
304 # if needed. This prevents problems with parallel builds.
305 config.h: stamp-h ; @true
306 stamp-h: config.in config.status Makefile
307 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
309 config.status: $(srcdir)/configure $(srcdir)/config.table
310 $(SHELL) ./config.status --recheck
312 # Depending on config.h makes sure that config.status has been re-run
313 # if needed. This prevents problems with parallel builds, in case
314 # subdirectories need to run config.status also.
315 all-subdir check-subdir installcheck-subdir info-subdir \
316 install-info-subdir clean-info-subdir dvi-subdir install-subdir \
317 etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
318 maintainer-clean-subdir: config.h
319 @subdirs='$(SUBDIRS)'; \
320 target=`echo $@ | sed -e 's/-subdir//'`; \
321 for dir in $$subdirs ; do \
322 cd $$dir && $(MAKE) $$target; \
325 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
327 alloca.o: config.h $(INCDIR)/libiberty.h
329 argv.o: config.h $(INCDIR)/libiberty.h
330 basename.o: $(INCDIR)/libiberty.h
331 choose-temp.o: config.h
333 concat.o: config.h $(INCDIR)/libiberty.h
334 cplus-dem.o: config.h $(INCDIR)/demangle.h
335 cp-demangle.o: config.h $(INCDIR)/dyn-string.h $(INCDIR)/demangle.h
336 dyn-string.o: config.h $(INCDIR)/dyn-string.h
337 fdmatch.o: $(INCDIR)/libiberty.h
338 fibheap.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/fibheap.h
339 fnmatch.o: config.h $(INCDIR)/fnmatch.h
341 getopt.o: config.h $(INCDIR)/getopt.h
342 getopt1.o: config.h $(INCDIR)/getopt.h
343 getpagesize.o: config.h
344 getpwd.o: config.h $(INCDIR)/libiberty.h
345 getruntime.o: config.h $(INCDIR)/libiberty.h
346 hex.o: $(INCDIR)/libiberty.h
347 floatformat.o: $(INCDIR)/floatformat.h
348 lbasename.o: $(INCDIR)/libiberty.h
349 make-temp-file.o: config.h
352 objalloc.o: config.h $(INCDIR)/objalloc.h
353 obstack.o: config.h $(INCDIR)/obstack.h
354 partition.o: config.h $(INCDIR)/partition.h
355 pexecute.o: config.h $(INCDIR)/libiberty.h
356 regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
359 sort.o: config.h $(INCDIR)/sort.h $(INCDIR)/ansidecl.h
360 spaces.o: $(INCDIR)/libiberty.h
361 splay-tree.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h $(INCDIR)/ansidecl.h
362 strerror.o: config.h $(INCDIR)/libiberty.h
363 strsignal.o: config.h $(INCDIR)/libiberty.h
366 ternary.o: config.h $(INCDIR)/ternary.h $(INCDIR)/libiberty.h
367 vasprintf.o: config.h
368 xatexit.o: $(INCDIR)/libiberty.h
369 xexit.o: config.h $(INCDIR)/libiberty.h
370 xmalloc.o: config.h $(INCDIR)/libiberty.h
371 xmemdup.o: config.h $(INCDIR)/libiberty.h
372 xstrdup.o: config.h $(INCDIR)/libiberty.h
373 xstrerror.o: config.h $(INCDIR)/libiberty.h
375 hashtab.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h $(INCDIR)/ansidecl.h