===================================================================
@@ -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
===================================================================
@@ -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