3 # Copyright (C) 1990, 91-99, 2000, 2001, 2002
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@
37 includedir = @includedir@
38 target_header_dir = @target_header_dir@
42 # Multilib support variables.
51 INSTALL_PROGRAM = @INSTALL_PROGRAM@
52 INSTALL_DATA = @INSTALL_DATA@
53 mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
69 TARGETLIB = libiberty.a
74 # A configuration can specify extra .o files that should be included,
75 # even if they are in libc. (Perhaps the libc version is buggy.)
78 # Flags to pass to a recursive make.
81 "AR_FLAGS=$(AR_FLAGS)" \
84 "LIBCFLAGS=$(LIBCFLAGS)" \
85 "EXTRA_OFILES=$(EXTRA_OFILES)" \
86 "HDEFINES=$(HDEFINES)" \
87 "INSTALL=$(INSTALL)" \
88 "INSTALL_DATA=$(INSTALL_DATA)" \
89 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
90 "LDFLAGS=$(LDFLAGS)" \
91 "LOADLIBES=$(LOADLIBES)" \
95 "exec_prefix=$(exec_prefix)" \
97 "libsubdir=$(libsubdir)" \
100 # Subdirectories to recurse into. We need to override this during cleaning
103 # FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
104 all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
105 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
107 .PHONY: check installcheck
109 installcheck: installcheck-subdir
113 INCDIR=$(srcdir)/$(MULTISRCTOP)../include
115 COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
117 if [ x"$(PICFLAG)" != x ]; then \
118 $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
122 # NOTE: If you add new files to the library, add them to this list
123 # (alphabetical), and add them to REQUIRED_OFILES, or
124 # CONFIGURED_OFILES and funcs in configure.in.
125 CFILES = alloca.c argv.c asprintf.c atexit.c \
126 basename.c bcmp.c bcopy.c bsearch.c bzero.c \
127 calloc.c choose-temp.c clock.c concat.c cp-demangle.c \
130 fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \
131 getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
135 make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \
136 memset.c mkstemps.c \
137 objalloc.c obstack.c \
138 partition.c pexecute.c putenv.c \
139 random.c regex.c rename.c rindex.c \
140 safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \
141 splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c \
142 strncasecmp.c strncmp.c strrchr.c strsignal.c strstr.c \
143 strtod.c strtol.c strtoul.c \
145 vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
147 xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
149 # These are always included in the library. The first four are listed
150 # first and by compile time to optimize parallel builds.
151 REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o \
153 choose-temp.o concat.o \
155 fdmatch.o fibheap.o floatformat.o fnmatch.o \
156 getopt.o getopt1.o getpwd.o getruntime.o \
160 objalloc.o obstack.o \
161 partition.o pexecute.o \
162 safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \
165 xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o
167 # These are all the objects that configure may add to the library via
168 # $funcs or EXTRA_OFILES. This list exists here only for "make
169 # maint-missing" and "make check".
170 CONFIGURED_OFILES = asprintf.o atexit.o \
171 basename.o bcmp.o bcopy.o bsearch.o bzero.o \
172 calloc.o clock.o copysign.o \
175 getcwd.o getpagesize.o \
177 memchr.o memcmp.o memcpy.o memmove.o memset.o mkstemps.o \
179 random.o rename.o rindex.o \
180 setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \
181 strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \
184 vasprintf.o vfork.o vfprintf.o vprintf.o vsprintf.o \
187 # These files are installed if the library has been configured to do so.
188 INSTALLED_HEADERS = \
189 $(INCDIR)/ansidecl.h \
190 $(INCDIR)/demangle.h \
191 $(INCDIR)/dyn-string.h \
192 $(INCDIR)/fibheap.h \
193 $(INCDIR)/floatformat.h \
194 $(INCDIR)/hashtab.h \
195 $(INCDIR)/libiberty.h \
196 $(INCDIR)/objalloc.h \
197 $(INCDIR)/partition.h \
198 $(INCDIR)/safe-ctype.h \
200 $(INCDIR)/splay-tree.h \
203 $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
204 -rm -f $(TARGETLIB) pic/$(TARGETLIB)
205 $(AR) $(AR_FLAGS) $(TARGETLIB) \
206 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
207 $(RANLIB) $(TARGETLIB)
208 if [ x"$(PICFLAG)" != x ]; then \
210 $(AR) $(AR_FLAGS) $(TARGETLIB) \
211 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
212 $(RANLIB) $(TARGETLIB); \
216 $(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
218 $(AR) $(AR_FLAGS) $(TESTLIB) \
219 $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
222 info: libiberty.info info-subdir
223 install-info: install-info-subdir
224 clean-info: clean-info-subdir
225 dvi: libiberty.dvi dvi-subdir
229 $(srcdir)/libiberty.texi \
230 $(srcdir)/copying-lib.texi \
231 $(srcdir)/obstacks.texi \
232 $(srcdir)/functions.texi
234 # Additional files that have texi snippets that need to be collected
235 # and sorted. Some are here because the sources are imported from
236 # elsewhere. Others represent headers in ../include.
237 TEXIFILES = fnmatch.txh
239 libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
240 $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
242 libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC)
243 texi2dvi $(srcdir)/libiberty.texi
245 libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
246 $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi
248 @MAINT@$(srcdir)/functions.texi : stamp-functions
251 @MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile
252 @MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
253 @MAINT@ echo stamp > stamp-functions
255 INSTALL_DEST = @INSTALL_DEST@
256 install: install_to_$(INSTALL_DEST) install-subdir
258 install_to_libdir: all
259 $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
260 ( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
261 mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
262 if test -n "${target_header_dir}"; then \
263 case "${target_header_dir}" in \
264 /*) thd=${target_header_dir};; \
265 *) thd=${includedir}${MULTISUBDIR}/${target_header_dir};; \
267 ${mkinstalldirs} $(DESTDIR)$${thd}; \
268 for h in ${INSTALLED_HEADERS}; do \
269 ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \
272 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
274 install_to_tooldir: all
275 $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
276 ( cd $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
277 mv -f $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
278 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
280 # needed-list is used by libstdc++. NEEDED is the list of functions
281 # to include there. Do not add anything LGPL to this list; libstdc++
282 # can't use anything encumbering.
283 NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
284 strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
285 vfork waitpid bcmp bcopy bzero
286 needed-list: Makefile
287 rm -f needed-list; touch needed-list; \
288 for f in $(NEEDED); do \
289 for g in $(LIBOBJS) $(EXTRA_OFILES); do \
291 *$$f*) echo $$g >> needed-list ;; \
296 # required-list was used when building a shared bfd/opcodes/libiberty
297 # library. I don't know if it used by anything currently.
298 required-list: Makefile
299 echo $(REQUIRED_OFILES) > required-list
302 if [ x"$(PICFLAG)" != x ] && [ ! -d pic ]; then \
307 .PHONY: all etags tags ls clean stage1 stage2
309 etags tags: TAGS etags-subdir
312 etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done`
314 # The standalone demangler (c++filt) has been moved to binutils.
316 @echo "The standalone demangler, now named c++filt, is now"
317 @echo "a part of binutils."
321 @echo Makefile $(CFILES)
323 # Various targets for maintainers.
326 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
328 maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
331 maint-undoc : $(srcdir)/functions.texi
332 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc
335 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) deps $(INCDIR)
337 # Need to deal with profiled libraries, too.
339 # Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
340 # multiple times, hence our explicit recursion with an empty SUBDIRS.
341 mostlyclean: mostlyclean-subdir
342 -rm -rf *.o pic core errs \#* *.E a.out
343 -rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
344 -rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
345 -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky
346 -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
347 -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr
349 @$(MULTICLEAN) multi-clean DO=mostlyclean
351 $(MAKE) SUBDIRS="" mostlyclean
352 -rm -f *.a required-list tmpmulti.out
353 -rm -f libiberty.dvi libiberty.info* libiberty.html
354 @$(MULTICLEAN) multi-clean DO=clean
355 distclean: distclean-subdir
356 $(MAKE) SUBDIRS="" clean
357 @$(MULTICLEAN) multi-clean DO=distclean
358 -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
360 -rmdir testsuite 2>/dev/null
361 maintainer-clean realclean: maintainer-clean-subdir
362 $(MAKE) SUBDIRS="" distclean
366 Makefile: $(srcdir)/Makefile.in config.status
367 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
369 # Depending on Makefile makes sure that config.status has been re-run
370 # if needed. This prevents problems with parallel builds.
371 config.h: stamp-h ; @true
372 stamp-h: config.in config.status Makefile
373 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
375 config.status: $(srcdir)/configure $(srcdir)/config.table
376 $(SHELL) ./config.status --recheck
378 # Depending on config.h makes sure that config.status has been re-run
379 # if needed. This prevents problems with parallel builds, in case
380 # subdirectories need to run config.status also.
381 all-subdir check-subdir installcheck-subdir info-subdir \
382 install-info-subdir clean-info-subdir dvi-subdir install-subdir \
383 etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
384 maintainer-clean-subdir: config.h
385 @subdirs='$(SUBDIRS)'; \
386 target=`echo $@ | sed -e 's/-subdir//'`; \
387 for dir in $$subdirs ; do \
388 cd $$dir && $(MAKE) $$target; \
391 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
392 $(CONFIGURED_OFILES): stamp-picdir
394 # The dependencies in the remainder of this file are automatically
395 # generated by "make maint-deps". Manual edits will be lost.
397 _doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
398 alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
399 argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
400 asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
402 basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
403 $(INCDIR)/safe-ctype.h
404 bsearch.o: config.h $(INCDIR)/ansidecl.h
405 calloc.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
406 choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
408 concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
409 copysign.o: $(INCDIR)/ansidecl.h
410 cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
411 $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h
412 cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
413 $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
414 dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \
415 $(INCDIR)/libiberty.h
416 fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
417 fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \
418 $(INCDIR)/libiberty.h
419 floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h
420 fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h
422 getopt.o: config.h $(INCDIR)/getopt.h
423 getopt1.o: config.h $(INCDIR)/getopt.h
424 getpagesize.o: config.h
425 getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
426 getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
427 hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
428 $(INCDIR)/libiberty.h
429 hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
430 lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
431 $(INCDIR)/safe-ctype.h
432 make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
433 md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
434 memchr.o: $(INCDIR)/ansidecl.h
435 memcmp.o: $(INCDIR)/ansidecl.h
436 memcpy.o: $(INCDIR)/ansidecl.h
437 memmove.o: $(INCDIR)/ansidecl.h
438 memset.o: $(INCDIR)/ansidecl.h
439 mkstemps.o: config.h $(INCDIR)/ansidecl.h
440 objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h
441 obstack.o: config.h $(INCDIR)/obstack.h
442 partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
443 $(INCDIR)/partition.h
444 pexecute.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
445 $(INCDIR)/safe-ctype.h
446 putenv.o: config.h $(INCDIR)/ansidecl.h
447 random.o: $(INCDIR)/ansidecl.h
448 regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
450 safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
451 setenv.o: config.h $(INCDIR)/ansidecl.h
452 sigsetmask.o: $(INCDIR)/ansidecl.h
453 sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
455 spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
456 splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
457 $(INCDIR)/splay-tree.h
458 strcasecmp.o: $(INCDIR)/ansidecl.h
459 strchr.o: $(INCDIR)/ansidecl.h
460 strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
461 strncasecmp.o: $(INCDIR)/ansidecl.h
462 strncmp.o: $(INCDIR)/ansidecl.h
463 strrchr.o: $(INCDIR)/ansidecl.h
464 strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
465 strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
466 strtol.o: config.h $(INCDIR)/safe-ctype.h
467 strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
468 ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
470 vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
471 vfork.o: $(INCDIR)/ansidecl.h
472 vprintf.o: $(INCDIR)/ansidecl.h
473 vsprintf.o: $(INCDIR)/ansidecl.h
475 xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
476 xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
477 xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
478 xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
479 xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
480 xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h