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
55 # Some compilers can't handle cc -c blah.c -o foo/blah.o.
56 OUTPUT_OPTION = @OUTPUT_OPTION@
72 TARGETLIB = libiberty.a
77 # A configuration can specify extra .o files that should be included,
78 # even if they are in libc. (Perhaps the libc version is buggy.)
81 # Flags to pass to a recursive make.
84 "AR_FLAGS=$(AR_FLAGS)" \
87 "LIBCFLAGS=$(LIBCFLAGS)" \
88 "EXTRA_OFILES=$(EXTRA_OFILES)" \
89 "HDEFINES=$(HDEFINES)" \
90 "INSTALL=$(INSTALL)" \
91 "INSTALL_DATA=$(INSTALL_DATA)" \
92 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
93 "LDFLAGS=$(LDFLAGS)" \
94 "LOADLIBES=$(LOADLIBES)" \
98 "exec_prefix=$(exec_prefix)" \
100 "libsubdir=$(libsubdir)" \
103 # Subdirectories to recurse into. We need to override this during cleaning
106 # FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
107 all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
108 @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
110 .PHONY: check installcheck
112 installcheck: installcheck-subdir
116 INCDIR=$(srcdir)/$(MULTISRCTOP)../include
118 COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
120 if [ x"$(PICFLAG)" != x ]; then \
121 $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
123 $(COMPILE.c) $< $(OUTPUT_OPTION)
125 # NOTE: If you add new files to the library, add them to this list
126 # (alphabetical), and add them to REQUIRED_OFILES, or
127 # CONFIGURED_OFILES and funcs in configure.in.
128 CFILES = alloca.c argv.c asprintf.c atexit.c \
129 basename.c bcmp.c bcopy.c bsearch.c bzero.c \
130 calloc.c choose-temp.c clock.c concat.c cp-demangle.c \
133 fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \
134 getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
138 make-relative-prefix.c \
139 make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \
140 memset.c mkstemps.c \
141 objalloc.c obstack.c \
142 partition.c pexecute.c putenv.c \
143 random.c regex.c rename.c rindex.c \
144 safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \
145 splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c \
146 strncasecmp.c strncmp.c strrchr.c strsignal.c strstr.c \
147 strtod.c strtol.c strtoul.c \
149 vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
151 xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
153 # These are always included in the library. The first four are listed
154 # first and by compile time to optimize parallel builds.
155 REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o \
157 choose-temp.o concat.o \
159 fdmatch.o fibheap.o floatformat.o fnmatch.o \
160 getopt.o getopt1.o getpwd.o getruntime.o \
163 make-relative-prefix.o \
165 objalloc.o obstack.o \
166 partition.o pexecute.o \
167 safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \
170 xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o
172 # These are all the objects that configure may add to the library via
173 # $funcs or EXTRA_OFILES. This list exists here only for "make
174 # maint-missing" and "make check".
175 CONFIGURED_OFILES = asprintf.o atexit.o \
176 basename.o bcmp.o bcopy.o bsearch.o bzero.o \
177 calloc.o clock.o copysign.o \
180 getcwd.o getpagesize.o \
182 memchr.o memcmp.o memcpy.o memmove.o memset.o mkstemps.o \
184 random.o rename.o rindex.o \
185 setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \
186 strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \
189 vasprintf.o vfork.o vfprintf.o vprintf.o vsprintf.o \
192 # These files are installed if the library has been configured to do so.
193 INSTALLED_HEADERS = \
194 $(INCDIR)/ansidecl.h \
195 $(INCDIR)/demangle.h \
196 $(INCDIR)/dyn-string.h \
197 $(INCDIR)/fibheap.h \
198 $(INCDIR)/floatformat.h \
199 $(INCDIR)/hashtab.h \
200 $(INCDIR)/libiberty.h \
201 $(INCDIR)/objalloc.h \
202 $(INCDIR)/partition.h \
203 $(INCDIR)/safe-ctype.h \
205 $(INCDIR)/splay-tree.h \
208 $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
209 -rm -f $(TARGETLIB) pic/$(TARGETLIB)
210 $(AR) $(AR_FLAGS) $(TARGETLIB) \
211 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
212 $(RANLIB) $(TARGETLIB)
213 if [ x"$(PICFLAG)" != x ]; then \
215 $(AR) $(AR_FLAGS) $(TARGETLIB) \
216 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
217 $(RANLIB) $(TARGETLIB); \
221 $(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
223 $(AR) $(AR_FLAGS) $(TESTLIB) \
224 $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
227 info: libiberty.info info-subdir
228 install-info: install-info-subdir
229 clean-info: clean-info-subdir
230 dvi: libiberty.dvi dvi-subdir
234 $(srcdir)/libiberty.texi \
235 $(srcdir)/copying-lib.texi \
236 $(srcdir)/obstacks.texi \
237 $(srcdir)/functions.texi
239 # Additional files that have texi snippets that need to be collected
240 # and sorted. Some are here because the sources are imported from
241 # elsewhere. Others represent headers in ../include.
242 TEXIFILES = fnmatch.txh
244 libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
245 $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
247 libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC)
248 texi2dvi $(srcdir)/libiberty.texi
250 libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
251 $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi
253 @MAINT@$(srcdir)/functions.texi : stamp-functions
256 @MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile
257 @MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
258 @MAINT@ echo stamp > stamp-functions
260 INSTALL_DEST = @INSTALL_DEST@
261 install: install_to_$(INSTALL_DEST) install-subdir
263 install_to_libdir: all
264 $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
265 ( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
266 mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
267 if test -n "${target_header_dir}"; then \
268 case "${target_header_dir}" in \
269 /*) thd=${target_header_dir};; \
270 *) thd=${includedir}${MULTISUBDIR}/${target_header_dir};; \
272 ${mkinstalldirs} $(DESTDIR)$${thd}; \
273 for h in ${INSTALLED_HEADERS}; do \
274 ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \
277 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
279 install_to_tooldir: all
280 $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
281 ( cd $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
282 mv -f $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
283 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
285 # needed-list is used by libstdc++. NEEDED is the list of functions
286 # to include there. Do not add anything LGPL to this list; libstdc++
287 # can't use anything encumbering.
288 NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
289 strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
290 vfork waitpid bcmp bcopy bzero
291 needed-list: Makefile
292 rm -f needed-list; touch needed-list; \
293 for f in $(NEEDED); do \
294 for g in $(LIBOBJS) $(EXTRA_OFILES); do \
296 *$$f*) echo $$g >> needed-list ;; \
301 # required-list was used when building a shared bfd/opcodes/libiberty
302 # library. I don't know if it used by anything currently.
303 required-list: Makefile
304 echo $(REQUIRED_OFILES) > required-list
307 if [ x"$(PICFLAG)" != x ] && [ ! -d pic ]; then \
312 .PHONY: all etags tags ls clean stage1 stage2
314 etags tags: TAGS etags-subdir
317 etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done`
319 # The standalone demangler (c++filt) has been moved to binutils.
321 @echo "The standalone demangler, now named c++filt, is now"
322 @echo "a part of binutils."
326 @echo Makefile $(CFILES)
328 # Various targets for maintainers.
331 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
333 maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
336 maint-undoc : $(srcdir)/functions.texi
337 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc
340 @$(PERL) $(srcdir)/maint-tool -s $(srcdir) deps $(INCDIR)
342 # Need to deal with profiled libraries, too.
344 # Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
345 # multiple times, hence our explicit recursion with an empty SUBDIRS.
346 mostlyclean: mostlyclean-subdir
347 -rm -rf *.o pic core errs \#* *.E a.out
348 -rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
349 -rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
350 -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky
351 -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
352 -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr
354 @$(MULTICLEAN) multi-clean DO=mostlyclean
356 $(MAKE) SUBDIRS="" mostlyclean
357 -rm -f *.a required-list tmpmulti.out
358 -rm -f libiberty.dvi libiberty.info* libiberty.html
359 @$(MULTICLEAN) multi-clean DO=clean
360 distclean: distclean-subdir
361 $(MAKE) SUBDIRS="" clean
362 @$(MULTICLEAN) multi-clean DO=distclean
363 -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
365 -rmdir testsuite 2>/dev/null
366 maintainer-clean realclean: maintainer-clean-subdir
367 $(MAKE) SUBDIRS="" distclean
371 Makefile: $(srcdir)/Makefile.in config.status
372 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
374 # Depending on Makefile makes sure that config.status has been re-run
375 # if needed. This prevents problems with parallel builds.
376 config.h: stamp-h ; @true
377 stamp-h: config.in config.status Makefile
378 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
380 config.status: $(srcdir)/configure $(srcdir)/config.table
381 $(SHELL) ./config.status --recheck
383 # Depending on config.h makes sure that config.status has been re-run
384 # if needed. This prevents problems with parallel builds, in case
385 # subdirectories need to run config.status also.
386 all-subdir check-subdir installcheck-subdir info-subdir \
387 install-info-subdir clean-info-subdir dvi-subdir install-subdir \
388 etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
389 maintainer-clean-subdir: config.h
390 @subdirs='$(SUBDIRS)'; \
391 target=`echo $@ | sed -e 's/-subdir//'`; \
392 for dir in $$subdirs ; do \
393 cd $$dir && $(MAKE) $$target; \
396 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
397 $(CONFIGURED_OFILES): stamp-picdir
399 # The dependencies in the remainder of this file are automatically
400 # generated by "make maint-deps". Manual edits will be lost.
402 _doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
403 alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
404 argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
405 asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
407 basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
408 $(INCDIR)/safe-ctype.h
409 bsearch.o: config.h $(INCDIR)/ansidecl.h
410 calloc.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
411 choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
413 concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
414 copysign.o: $(INCDIR)/ansidecl.h
415 cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
416 $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h
417 cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
418 $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
419 dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \
420 $(INCDIR)/libiberty.h
421 fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
422 fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \
423 $(INCDIR)/libiberty.h
424 floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h
425 fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h
427 getopt.o: config.h $(INCDIR)/getopt.h
428 getopt1.o: config.h $(INCDIR)/getopt.h
429 getpagesize.o: config.h
430 getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
431 getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
432 hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
433 $(INCDIR)/libiberty.h
434 hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
435 lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
436 $(INCDIR)/safe-ctype.h
437 make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
438 make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
439 md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
440 memchr.o: $(INCDIR)/ansidecl.h
441 memcmp.o: $(INCDIR)/ansidecl.h
442 memcpy.o: $(INCDIR)/ansidecl.h
443 memmove.o: $(INCDIR)/ansidecl.h
444 memset.o: $(INCDIR)/ansidecl.h
445 mkstemps.o: config.h $(INCDIR)/ansidecl.h
446 objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h
447 obstack.o: config.h $(INCDIR)/obstack.h
448 partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
449 $(INCDIR)/partition.h
450 pexecute.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
451 $(INCDIR)/safe-ctype.h
452 putenv.o: config.h $(INCDIR)/ansidecl.h
453 random.o: $(INCDIR)/ansidecl.h
454 regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
456 safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
457 setenv.o: config.h $(INCDIR)/ansidecl.h
458 sigsetmask.o: $(INCDIR)/ansidecl.h
459 sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
461 spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
462 splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
463 $(INCDIR)/splay-tree.h
464 strcasecmp.o: $(INCDIR)/ansidecl.h
465 strchr.o: $(INCDIR)/ansidecl.h
466 strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
467 strncasecmp.o: $(INCDIR)/ansidecl.h
468 strncmp.o: $(INCDIR)/ansidecl.h
469 strrchr.o: $(INCDIR)/ansidecl.h
470 strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
471 strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
472 strtol.o: config.h $(INCDIR)/safe-ctype.h
473 strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
474 ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
476 vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
477 vfork.o: $(INCDIR)/ansidecl.h
478 vprintf.o: $(INCDIR)/ansidecl.h
479 vsprintf.o: $(INCDIR)/ansidecl.h
481 xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
482 xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
483 xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
484 xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
485 xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
486 xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h