OSDN Git Service

* cp-demangle.c (d_demangle): If DMGL_PARAMS is not set, don't
[pf3gnuchains/gcc-fork.git] / libiberty / Makefile.in
index 71d02a3..5fff39b 100644 (file)
@@ -1,6 +1,7 @@
 #
 # Makefile
-#   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation
+#   Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003
+#   Free Software Foundation
 #
 # This file is part of the libiberty library.
 # Libiberty is free software; you can redistribute it and/or
 # Boston, MA 02111-1307, USA.
 #
 
-# This file was written, and is maintained by K. Richard Pixley
-# <rich@cygnus.com>.
+# This file was written by K. Richard Pixley <rich@cygnus.com>.
 
 #
 # Makefile for libiberty directory
 #
 
-srcdir = .
+libiberty_topdir = @libiberty_topdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
 
-prefix = /usr/local
+prefix = @prefix@
 
-exec_prefix = $(prefix)
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+includedir = @includedir@
+target_header_dir = @target_header_dir@
 
-datadir = $(prefix)/share
-
-mandir = $(prefix)/man
-man1dir = $(mandir)/man1
-man2dir = $(mandir)/man2
-man3dir = $(mandir)/man3
-man4dir = $(mandir)/man4
-man5dir = $(mandir)/man5
-man6dir = $(mandir)/man6
-man7dir = $(mandir)/man7
-man8dir = $(mandir)/man8
-man9dir = $(mandir)/man9
-infodir = $(prefix)/info
-includedir = $(prefix)/include
-
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 # Multilib support variables.
 MULTISRCTOP =
@@ -59,39 +48,32 @@ MULTISUBDIR =
 MULTIDO = true
 MULTICLEAN = true
 
-INSTALL = install -c
-INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL)
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs
+
+# Some compilers can't handle cc -c blah.c -o foo/blah.o.
+OUTPUT_OPTION = @OUTPUT_OPTION@
 
-AR = ar
+AR = @AR@
 AR_FLAGS = rc
 
-ERRORS_CC = $(CC)
-CC = cc
-CFLAGS = -g
+CC = @CC@
+CFLAGS = @CFLAGS@
 LIBCFLAGS = $(CFLAGS)
-MAKEINFO = makeinfo
-RANLIB = ranlib
+RANLIB = @RANLIB@
+MAKEINFO = @MAKEINFO@
+PERL = @PERL@
 
 PICFLAG =
 
 MAKEOVERRIDES =
 
 TARGETLIB = libiberty.a
+TESTLIB = testlib.a
 
-CONFIG_H = lconfig.h
-NEEDED_LIST = lneeded-list
-
-# HOST_OFILES contains the list of objects that should be in the
-# library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
-# A configuration may override this with a fixed list a object files
-# names (hard to maintain), or some other way to generate a list.
-HOST_OFILES=`cat needed-list`
-
-# Extra targets that the top-level target depends on.
-# Specifically, what needs to be made before HOST_OFILES can be used.
-# Can be empty if HOST_OFILES is just a list of file names.
-DO_ALSO = needed-list
+LIBOBJS = @LIBOBJS@
 
 # A configuration can specify extra .o files that should be included,
 # even if they are in libc. (Perhaps the libc version is buggy.)
@@ -103,6 +85,7 @@ FLAGS_TO_PASS = \
        "AR_FLAGS=$(AR_FLAGS)" \
        "CC=$(CC)" \
        "CFLAGS=$(CFLAGS)" \
+       "DESTDIR=$(DESTDIR)" \
        "LIBCFLAGS=$(LIBCFLAGS)" \
        "EXTRA_OFILES=$(EXTRA_OFILES)" \
        "HDEFINES=$(HDEFINES)" \
@@ -112,175 +95,242 @@ FLAGS_TO_PASS = \
        "LDFLAGS=$(LDFLAGS)" \
        "LOADLIBES=$(LOADLIBES)" \
        "RANLIB=$(RANLIB)" \
-       "SHELL=$(SHELL)"
+       "SHELL=$(SHELL)" \
+       "prefix=$(prefix)" \
+       "exec_prefix=$(exec_prefix)" \
+       "libdir=$(libdir)" \
+       "libsubdir=$(libsubdir)" \
+       "tooldir=$(tooldir)"
 
-all: stamp-picdir $(TARGETLIB) required-list
-       @if [ "$(RULE1)" != "not-used" ]; then \
-         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \
-       else true; \
-       fi
+# Subdirectories to recurse into. We need to override this during cleaning
+SUBDIRS = testsuite
 
-.PHONY: check installcheck
-check installcheck:
+# FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
+all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
+       @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
 
+.PHONY: check installcheck
+check: check-subdir
+installcheck: installcheck-subdir
 
-#### Host, target, and site specific Makefile fragments come in here.
-###
+@host_makefile_frag@
 
 INCDIR=$(srcdir)/$(MULTISRCTOP)../include
 
-COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
+COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
 .c.o:
-       test x"$(enable_shared)" != xyes || \
-         $(COMPILE.c) $(PICFLAG) $< -o pic/$@
-       $(COMPILE.c) $<
+       if [ x"$(PICFLAG)" != x ]; then \
+         $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
+       else true; fi
+       $(COMPILE.c) $< $(OUTPUT_OPTION)
 
-# The default target just invokes make recursively.
-# However, the automatic configuration (in config/mh_default).
-# first causes it to figure out the objects missing in libc.
-info install-info clean-info dvi:
+# NOTE: If you add new files to the library, add them to this list
+# (alphabetical), and add them to REQUIRED_OFILES, or
+# CONFIGURED_OFILES and funcs in configure.in.
+CFILES = alloca.c argv.c asprintf.c atexit.c                           \
+       basename.c bcmp.c bcopy.c bsearch.c bzero.c                     \
+       calloc.c choose-temp.c clock.c concat.c cp-demangle.c           \
+        cplus-dem.c                                                    \
+       dyn-string.c                                                    \
+       fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c               \
+       getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
+       hashtab.c hex.c                                                 \
+       index.c insque.c                                                \
+       lbasename.c                                                     \
+       lrealpath.c                                                     \
+       make-relative-prefix.c                                          \
+       make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c     \
+        mempcpy.c memset.c mkstemps.c                                  \
+       objalloc.c obstack.c                                            \
+       partition.c                                                     \
+        pex-djgpp.c pex-mpw.c pex-msdos.c pex-os2.c                    \
+        pex-unix.c pex-win32.c                                         \
+         physmem.c putenv.c                                            \
+       random.c regex.c rename.c rindex.c                              \
+       safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c   \
+        splay-tree.c stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \
+        strerror.c strncasecmp.c strncmp.c strrchr.c strsignal.c       \
+        strstr.c strtod.c strtol.c strtoul.c                           \
+       ternary.c tmpnam.c                                              \
+       vasprintf.c vfork.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c \
+       waitpid.c                                                       \
+       xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
+
+# These are always included in the library.  The first four are listed
+# first and by compile time to optimize parallel builds.
+REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o              \
+       alloca.o argv.o                                                 \
+       choose-temp.o concat.o                                          \
+       dyn-string.o                                                    \
+       fdmatch.o fibheap.o floatformat.o fnmatch.o                     \
+       getopt.o getopt1.o getpwd.o getruntime.o                        \
+       hashtab.o hex.o                                                 \
+       lbasename.o                                                     \
+       lrealpath.o                                                     \
+       make-relative-prefix.o                                          \
+       make-temp-file.o                                                \
+       objalloc.o obstack.o                                            \
+       partition.o physmem.o @pexecute@                                                \
+       safe-ctype.o sort.o spaces.o splay-tree.o strerror.o            \
+        strsignal.o                                                    \
+       ternary.o                                                       \
+       xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o
+
+# These are all the objects that configure may add to the library via
+# $funcs or EXTRA_OFILES.  This list exists here only for "make
+# maint-missing" and "make check".
+CONFIGURED_OFILES = asprintf.o atexit.o                                        \
+       basename.o bcmp.o bcopy.o bsearch.o bzero.o                     \
+       calloc.o clock.o copysign.o                                     \
+       _doprnt.o                                                       \
+       ffs.o                                                           \
+       getcwd.o getpagesize.o                                          \
+       index.o insque.o                                                \
+       memchr.o memcmp.o memcpy.o memmove.o mempcpy.o memset.o mkstemps.o \
+       pex-djgpp.o pex-mpw.o pex-msdos.o pex-os2.o                     \
+        pex-unix.o pex-win32.o                                         \
+        putenv.o                                                       \
+       random.o rename.o rindex.o                                      \
+       setenv.o sigsetmask.o snprintf.o stpcpy.o stpncpy.o strcasecmp.o \
+        strchr.o strdup.o strncasecmp.o strncmp.o strrchr.o strstr.o   \
+        strtod.o strtol.o strtoul.o                                    \
+       tmpnam.o                                                        \
+       vasprintf.o vfork.o vfprintf.o vprintf.o vsnprintf.o vsprintf.o \
+       waitpid.o
+
+# These files are installed if the library has been configured to do so.
+INSTALLED_HEADERS =                                                     \
+       $(INCDIR)/ansidecl.h                                            \
+       $(INCDIR)/demangle.h                                            \
+       $(INCDIR)/dyn-string.h                                          \
+       $(INCDIR)/fibheap.h                                             \
+       $(INCDIR)/floatformat.h                                         \
+       $(INCDIR)/hashtab.h                                             \
+       $(INCDIR)/libiberty.h                                           \
+       $(INCDIR)/objalloc.h                                            \
+       $(INCDIR)/partition.h                                           \
+       $(INCDIR)/safe-ctype.h                                          \
+       $(INCDIR)/sort.h                                                \
+       $(INCDIR)/splay-tree.h                                          \
+       $(INCDIR)/ternary.h
+
+$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+       -rm -f $(TARGETLIB) pic/$(TARGETLIB)
+       $(AR) $(AR_FLAGS) $(TARGETLIB) \
+         $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+       $(RANLIB) $(TARGETLIB)
+       if [ x"$(PICFLAG)" != x ]; then \
+         cd pic; \
+         $(AR) $(AR_FLAGS) $(TARGETLIB) \
+           $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+         $(RANLIB) $(TARGETLIB); \
+         cd ..; \
+       else true; fi
 
-# Include files that are in this directory.
-HFILES =
+$(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
+       -rm -f $(TESTLIB)
+       $(AR) $(AR_FLAGS) $(TESTLIB) \
+         $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
+       $(RANLIB) $(TESTLIB)
 
-# NOTE: If you add new files to the library, add them to this list
-# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
-CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c bzero.c \
-        choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c fnmatch.c \
-        getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
-         floatformat.c hex.c index.c insque.c \
-        memchr.c memcmp.c memcpy.c memmove.c memset.c objalloc.c \
-         obstack.c pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.c \
-        strcasecmp.c strncasecmp.c \
-         strchr.c strdup.c strerror.c strrchr.c strsignal.c \
-         strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
-        vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \
-        xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c
-# These are always included in the library.
-REQUIRED_OFILES = argv.o basename.o choose-temp.o concat.o cplus-dem.o \
-  fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \
-  floatformat.o objalloc.o obstack.o pexecute.o spaces.o strerror.o \
-  strsignal.o xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o
-
-# Do we want/need any config overrides?
-#       
-
-STAGESTUFF = $(TARGETLIB) *.o
-
-INSTALL_DEST = libdir
-install: install_to_$(INSTALL_DEST)
+info: libiberty.info info-subdir
+install-info: install-info-subdir
+clean-info: clean-info-subdir
+dvi: libiberty.dvi dvi-subdir
+html: libiberty.html
+
+TEXISRC = \
+       $(srcdir)/libiberty.texi \
+       $(srcdir)/copying-lib.texi \
+       $(srcdir)/obstacks.texi \
+       $(srcdir)/functions.texi
+
+# Additional files that have texi snippets that need to be collected
+# and sorted.  Some are here because the sources are imported from
+# elsewhere.  Others represent headers in ../include.
+TEXIFILES = fnmatch.txh pexecute.txh
+
+libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
+       $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
+
+libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC)
+       texi2dvi $(srcdir)/libiberty.texi
+
+libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
+       $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi
+
+@MAINT@$(srcdir)/functions.texi : stamp-functions
+@MAINT@        @true
+
+@MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile
+@MAINT@@HAVE_PERL@     $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
+@MAINT@        echo stamp > stamp-functions
+
+INSTALL_DEST = @INSTALL_DEST@
+install: install_to_$(INSTALL_DEST) install-subdir
 
 install_to_libdir: all
-       $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n
-       ( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
-       mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
+       ${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)
+       $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
+       ( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
+       mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
+       if test -n "${target_header_dir}"; then \
+         case "${target_header_dir}" in \
+           /*)    thd=${target_header_dir};; \
+           *)     thd=${includedir}${MULTISUBDIR}/${target_header_dir};; \
+         esac; \
+         ${mkinstalldirs} $(DESTDIR)$${thd}; \
+         for h in ${INSTALLED_HEADERS}; do \
+           ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \
+         done; \
+       fi
        @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
 
+# This is tricky.  Even though CC in the Makefile contains
+# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
+# default multilib, so we have to take LIBCFLAGS into account as well,
+# since it will be passed the multilib flags.
+MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory`
 install_to_tooldir: all
-       $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n
-       ( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
-       mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
+       ${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)
+       $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n
+       ( cd $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) ; $(RANLIB) $(TARGETLIB)n )
+       mv -f $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)
        @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
 
-# The default configuration adds to libiberty all those functions that are
-# missing in libc.  More precisely, it includes whatever $(CC) fails to find.
-# Then a sed+awk combination translates the ld error messages into
-# a list of .o files.
-
-stamp-needed: stamp-picdir $(NEEDED_LIST)
-       cp $(NEEDED_LIST) needed-tmp
-       $(SHELL) $(srcdir)/$(MULTISRCTOP)../move-if-change needed-tmp needed-list
-       touch stamp-needed
-
-needed-list: stamp-needed ; @true
-
-lneeded-list: $(EXTRA_OFILES) needed.awk errors
-       rm -f lneeded-list
-       f=""; \
-       for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
-         case " $$f " in \
-           *" $$i "*) ;; \
-           *) f="$$f $$i" ;; \
-         esac ; \
-       done ; \
-       case $$f in \
-           *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \
-       esac ; \
-       echo $$f >>lneeded-list
-
-# Generate an awk script that looks for functions in functions.def
-
-needed.awk: $(srcdir)/functions.def Makefile
-       echo "# !Automatically generated from $(srcdir)/functions.def"\
-         "- DO NOT EDIT!" >needed.awk
-       grep '^DEF(' < $(srcdir)/functions.def \
-           | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
-           >>needed.awk
-
-stamp-config: $(CONFIG_H)
-       cp $(CONFIG_H) config.tmp
-       $(SHELL) $(srcdir)/$(MULTISRCTOP)../move-if-change config.tmp config.h
-       touch stamp-config
-
-config.h: stamp-config ; @true
-
-lconfig.h: needed2.awk errors
-       echo "/* !Automatically generated from $(srcdir)/functions.def"\
-         "- DO NOT EDIT! */" >lconfig.h
-       awk -f needed2.awk <errors >>lconfig.h
-
-# Generate an awk script that looks for variables in functions.def
-
-needed2.awk: $(srcdir)/functions.def Makefile
-       echo "# !Automatically generated from $(srcdir)/functions.def"\
-         "- DO NOT EDIT!" >needed2.awk
-       grep '^DEFVAR(' < $(srcdir)/functions.def \
-        | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
-        >>needed2.awk
-       grep '^DEFFUNC(' < $(srcdir)/functions.def \
-        | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
-        >>needed2.awk
-
-dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
-       $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null
-
-errors: dummy.o $(EXTRA_OFILES)
-       -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
-
-# required-list is used when building a shared bfd/opcodes/libiberty library.
+# needed-list is used by libstdc++.  NEEDED is the list of functions
+# to include there.  Do not add anything LGPL to this list; libstdc++
+# can't use anything encumbering.
+NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
+        strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
+        vfork waitpid bcmp bcopy bzero
+needed-list: Makefile
+       rm -f needed-list; touch needed-list; \
+       for f in $(NEEDED); do \
+         for g in $(LIBOBJS) $(EXTRA_OFILES); do \
+           case "$$g" in \
+             *$$f*) echo $$g >> needed-list ;; \
+           esac; \
+         done; \
+       done
+
+# required-list was used when building a shared bfd/opcodes/libiberty
+# library.  I don't know if it used by anything currently.
 required-list: Makefile
        echo $(REQUIRED_OFILES) > required-list
 
-$(HOST_OFILES) $(REQUIRED_OFILES) : config.h
-
-RULE1 = $(TARGETLIB)
-$(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
-       @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
-               "HOST_OFILES=$(HOST_OFILES)"
-
-# Rule invoked by recursive make in $(RULE1).
-RULE2 = not-used
-$(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
-       rm -rf $(TARGETLIB)
-       $(AR) $(AR_FLAGS) $(TARGETLIB) \
-         $(REQUIRED_OFILES) $(HOST_OFILES)
-       $(RANLIB) $(TARGETLIB)
-
 stamp-picdir:
-       if [ x"$(enable_shared)" = xyes ] && [ ! -d pic ]; then \
+       if [ x"$(PICFLAG)" != x ] && [ ! -d pic ]; then \
          mkdir pic; \
        else true; fi
        touch stamp-picdir
 
-.always.:
-# Do nothing.
+.PHONY: all etags tags ls clean stage1 stage2
 
-.PHONY: all etags tags ls clean stage1 stage2 .always.
+etags tags: TAGS etags-subdir
 
-etags tags: TAGS
-
-TAGS: $(CFILES) $(HFILES)
-       etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
+TAGS: $(CFILES)
+       etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done`
 
 # The standalone demangler (c++filt) has been moved to binutils.
 demangle:
@@ -289,47 +339,186 @@ demangle:
        @false
 
 ls:
-       @echo Makefile $(HFILES) $(CFILES)
+       @echo Makefile $(CFILES)
+
+# Various targets for maintainers.
+
+maint-missing :
+       @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
+
+maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
+       @true
+
+maint-undoc : $(srcdir)/functions.texi
+       @$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc
+
+maint-deps :
+       @$(PERL) $(srcdir)/maint-tool -s $(srcdir) deps $(INCDIR)
 
 # Need to deal with profiled libraries, too.
 
-mostlyclean:
-       rm -rf *.o pic core errs \#* *.E a.out
-       rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
-       rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
+# Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
+# multiple times, hence our explicit recursion with an empty SUBDIRS.
+mostlyclean: mostlyclean-subdir
+       -rm -rf *.o pic core errs \#* *.E a.out
+       -rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
+       -rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
+       -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky
+       -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
+       -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr
+       -rm -f libtexi.stamp
        @$(MULTICLEAN) multi-clean DO=mostlyclean
-clean: mostlyclean
-       rm -f *.a required-list tmpmulti.out
+clean: clean-subdir
+       $(MAKE) SUBDIRS="" mostlyclean
+       -rm -f *.a required-list tmpmulti.out
+       -rm -f libiberty.dvi libiberty.info* libiberty.html
        @$(MULTICLEAN) multi-clean DO=clean
-distclean: clean
+distclean: distclean-subdir
+       $(MAKE) SUBDIRS="" clean
        @$(MULTICLEAN) multi-clean DO=distclean
-       rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS multilib.out
-maintainer-clean realclean: distclean
+       -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
+       -rm -f config.log
+       -rmdir testsuite 2>/dev/null
+maintainer-clean realclean: maintainer-clean-subdir
+       $(MAKE) SUBDIRS="" distclean
 
 force:
 
-Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
-       $(SHELL) ./config.status
-
-argv.o: $(INCDIR)/libiberty.h
-basename.o: $(INCDIR)/libiberty.h
-concat.o: $(INCDIR)/libiberty.h
-cplus-dem.o: $(INCDIR)/demangle.h
-fdmatch.o: $(INCDIR)/libiberty.h
-fnmatch.o: $(INCDIR)/fnmatch.h
-getopt.o: $(INCDIR)/getopt.h
-getopt1.o: $(INCDIR)/getopt.h
-getruntime.o: $(INCDIR)/libiberty.h
-hex.o: $(INCDIR)/libiberty.h
-floatformat.o: $(INCDIR)/floatformat.h
-objalloc.o: $(INCDIR)/objalloc.h
-obstack.o: $(INCDIR)/obstack.h
-pexecute.o: $(INCDIR)/libiberty.h
-spaces.o: $(INCDIR)/libiberty.h
-strerror.o: $(INCDIR)/libiberty.h
-strsignal.o: $(INCDIR)/libiberty.h
-xatexit.o: $(INCDIR)/libiberty.h
-xexit.o: $(INCDIR)/libiberty.h
-xmalloc.o: $(INCDIR)/libiberty.h
-xstrdup.o: $(INCDIR)/libiberty.h
-xstrerror.o: $(INCDIR)/libiberty.h
+Makefile: $(srcdir)/Makefile.in config.status
+       CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
+
+# Depending on Makefile makes sure that config.status has been re-run
+# if needed.  This prevents problems with parallel builds.
+config.h: stamp-h ; @true
+stamp-h: config.in config.status Makefile
+       CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
+
+config.status: $(srcdir)/configure $(srcdir)/config.table
+       $(SHELL) ./config.status --recheck
+
+# Depending on config.h makes sure that config.status has been re-run
+# if needed.  This prevents problems with parallel builds, in case
+# subdirectories need to run config.status also.
+all-subdir check-subdir installcheck-subdir info-subdir        \
+install-info-subdir clean-info-subdir dvi-subdir install-subdir        \
+etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
+maintainer-clean-subdir: config.h
+       @subdirs='$(SUBDIRS)'; \
+       target=`echo $@ | sed -e 's/-subdir//'`; \
+       for dir in $$subdirs ; do \
+         cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $$target; \
+       done
+
+$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
+$(CONFIGURED_OFILES): stamp-picdir
+
+# The dependencies in the remainder of this file are automatically
+# generated by "make maint-deps".  Manual edits will be lost.
+
+_doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
+alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+atexit.o: config.h
+basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(INCDIR)/safe-ctype.h
+bsearch.o: config.h $(INCDIR)/ansidecl.h
+calloc.o: $(INCDIR)/ansidecl.h
+choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+clock.o: config.h
+concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+copysign.o: $(INCDIR)/ansidecl.h
+cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
+       $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h
+cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
+       $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \
+       $(INCDIR)/libiberty.h
+fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \
+       $(INCDIR)/libiberty.h
+floatformat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h \
+       $(INCDIR)/libiberty.h
+fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h
+getcwd.o: config.h
+getopt.o: config.h $(INCDIR)/getopt.h
+getopt1.o: config.h $(INCDIR)/getopt.h
+getpagesize.o: config.h
+getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
+       $(INCDIR)/libiberty.h
+hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(INCDIR)/safe-ctype.h
+lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(INCDIR)/safe-ctype.h
+lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h \
+       $(INCDIR)/libiberty.h
+make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
+memchr.o: $(INCDIR)/ansidecl.h
+memcmp.o: $(INCDIR)/ansidecl.h
+memcpy.o: $(INCDIR)/ansidecl.h
+memmove.o: $(INCDIR)/ansidecl.h
+mempcpy.o: $(INCDIR)/ansidecl.h
+memset.o: $(INCDIR)/ansidecl.h
+mkstemps.o: config.h $(INCDIR)/ansidecl.h
+objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h
+obstack.o: config.h $(INCDIR)/obstack.h
+partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(INCDIR)/partition.h
+pex-djgpp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(srcdir)/pex-common.h
+pex-mpw.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(srcdir)/pex-common.h
+pex-msdos.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(srcdir)/pex-common.h $(INCDIR)/safe-ctype.h
+pex-os2.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(srcdir)/pex-common.h
+pex-unix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(srcdir)/pex-common.h
+pex-win32.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(srcdir)/pex-common.h
+physmem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+putenv.o: config.h $(INCDIR)/ansidecl.h
+random.o: $(INCDIR)/ansidecl.h
+regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
+rename.o: config.h $(INCDIR)/ansidecl.h
+safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
+setenv.o: config.h $(INCDIR)/ansidecl.h
+sigsetmask.o: $(INCDIR)/ansidecl.h
+snprintf.o: $(INCDIR)/ansidecl.h
+sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(INCDIR)/sort.h
+spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(INCDIR)/splay-tree.h
+stpcpy.o: $(INCDIR)/ansidecl.h
+stpncpy.o: $(INCDIR)/ansidecl.h
+strcasecmp.o: $(INCDIR)/ansidecl.h
+strchr.o: $(INCDIR)/ansidecl.h
+strdup.o: $(INCDIR)/ansidecl.h
+strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+strncasecmp.o: $(INCDIR)/ansidecl.h
+strncmp.o: $(INCDIR)/ansidecl.h
+strrchr.o: $(INCDIR)/ansidecl.h
+strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
+strtol.o: config.h $(INCDIR)/safe-ctype.h
+strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
+ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+       $(INCDIR)/ternary.h
+vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+vfork.o: $(INCDIR)/ansidecl.h
+vfprintf.o: $(INCDIR)/ansidecl.h
+vprintf.o: $(INCDIR)/ansidecl.h
+vsnprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+vsprintf.o: $(INCDIR)/ansidecl.h
+waitpid.o: config.h
+xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h