The libbacktrace library uses automake, so I just had it use automake's automatic dependency tracking. Unfortunately, that turns out not to work when building with "make bootstrap-lean". As I wrote in the appended patch:
# We can't use automake's automatic dependency tracking, because it # breaks when using bootstrap-lean. Automatic dependency tracking # with GCC bootstrap will cause some of the objects to depend on # header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When # using bootstrap-lean, prev-gcc is removed after each stage. When # running "make install", those header files will be gone, causing the # library to be rebuilt at install time. That may not succeed. This patch changes libbacktrace to use manually written dependencies instead. This is too bad, but the dependencies are pretty simple and unlikely to change much. Bootstrapped with "make bootstrap" and "make bootstrap-lean" and ran libbacktrace testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2012-09-27 Ian Lance Taylor <i...@google.com> PR bootstrap/54732 * configure.ac: Add no-dependencies to AM_INIT_AUTOMAKE. * Makefile.am: Add dependencies for all objects. * configure, aclocal.m4, Makefile.in: Rebuild.
Index: configure.ac =================================================================== --- configure.ac (revision 191810) +++ configure.ac (working copy) @@ -42,7 +42,16 @@ AC_USE_SYSTEM_EXTENSIONS libtool_VERSION=1:0:0 AC_SUBST(libtool_VERSION) -AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define -Wall -Wno-portability]) +# 1.11.1: Require that version of automake. +# foreign: Don't require README, INSTALL, NEWS, etc. +# no-define: Don't define PACKAGE and VERSION. +# no-dependencies: Don't generate automatic dependencies. +# (because it breaks when using bootstrap-lean, since some of the +# headers are gone at "make install" time). +# -Wall: Issue all automake warnings. +# -Wno-portability: Don't warn about constructs supported by GNU make. +# (because GCC requires GNU make anyhow). +AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies -Wall -Wno-portability]) AM_MAINTAINER_MODE Index: Makefile.am =================================================================== --- Makefile.am (revision 191810) +++ Makefile.am (working copy) @@ -93,3 +93,33 @@ btest_LDADD = libbacktrace.la check_PROGRAMS += btest endif NATIVE + +# We can't use automake's automatic dependency tracking, because it +# breaks when using bootstrap-lean. Automatic dependency tracking +# with GCC bootstrap will cause some of the objects to depend on +# header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When +# using bootstrap-lean, prev-gcc is removed after each stage. When +# running "make install", those header files will be gone, causing the +# library to be rebuilt at install time. That may not succeed. + +# These manual dependencies do not include dependencies on unwind.h, +# even though that is part of GCC, because where to find it depends on +# whether we are being built as a host library or a target library. + +INCDIR = $(top_srcdir)/../include +alloc.lo: config.h backtrace.h internal.h +backtrace.lo: config.h backtrace.h +btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h +dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \ + $(INCDIR)/filenames.h backtrace.h internal.h +elf.lo: config.h backtrace.h internal.h +fileline.lo: config.h backtrace.h internal.h +mmap.lo: config.h backtrace.h internal.h +mmapio.lo: config.h backtrace.h internal.h +nounwind.lo: config.h internal.h +posix.lo: config.h backtrace.h internal.h +print.lo: config.h backtrace.h internal.h +read.lo: config.h backtrace.h internal.h +simple.lo: config.h backtrace.h internal.h +state.lo: config.h backtrace.h backtrace-supported.h internal.h +unknown.lo: config.h backtrace.h internal.h