This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: (toplevel) Fix dramatic breakage for ordinary crosses (related to program_transform_name)
On Dec 28, 2002, Alexandre Oliva <aoliva@redhat.com> wrote:
> I'm working on something that will require configure options to
> disable the serialized configurations, but more and more I think we
> might as well turn them on by default. It's not like make -j is
> default or anything, and whoever uses make -j might also be expected
> to configure with an option that makes the build 100% -j-safe.
Here's the patch I came up with. I'm not putting it in for now (which
is why there are no ChangeLogs), and I'm not documenting the new
configure options anywhere, since they're still open for debate. It
also fixes a number of problems:
- for some reason I don't understand, the multilib.out/multilib.ts
pair was causing maybe-all-gcc to be resolved twice. It appears
that make was being re-entered to rebuild multilib.ts even though it
wasn't actually necessary. I came up with a simpler construct that
amounts to the same result. After all, multilib.ts was always going
to be newer than multilib.out anyway, and we always constructed
multilib.ts anyway, so...
- using the Makefiles to represent the actual configure-* targets was
rendering the explicit dependencies of configure-* targets in the
`Dependencies between different modules' useless. Since say
configure-foo depended on maybe-configure-bar and foo/Makefile, they
could be built in parallel, and then configure-foo would be built
with a do-nothing. I've rearranged for us to go back to the phony
configure-* targets, and added explicit tests for the target's
Makefile to short-circuit the configure process. To make sure
target libraries are reconfigured when multilib.out changes, the
update of multilib.out removes the target library's Makefile from
the build dir, forcing its configure to run.
- I've also removed the dependence of configure-* on ./config.status.
I don't understand why we put this in. I get the impression it was
a mistake, since the earlier top-level (say in the gcc-3.3 branch)
does not get any sub-packages reconfigured just because the top
level config.status changes. If we really want to do this, we
should arrange for the code that updates config.status in the
top-level to also remove the Makefiles of all subdirs, so that
they're reconfigured next.
- I've made sure that maybedep.tmp and serdep.tmp are never empty, and
that they contain a marker indicating where these pieces of Makefile
content came from.
- the changes to introduce the new configure options,
--disable-serial-configure, --disable-serial-build-configure,
--disable-serial-host-configure and --disable-serial-target-configure,
are the few `test' lines added to configure.in. Should they be
accepted, I'd add calls to AC_ARG_ENABLE to get them documented in
configure --help, and to the top-level configure docs. I'd much
rather have all serial configure disabled by default, though.
I'm also thinking we might be able to diagnose the presence of
-j in MAKEFLAGS and warn in case the serial dependencies are not
enabled, or even arrange for the Makefile to be automatically
regenerated containing such dependencies. Something like this in the
default serdep.tmp:
SERIALIZE_PARALLEL_CONFIGURE = force
serdep.tmp: $(SERIALIZE_PARALLEL_CONFIGURE)
@if echo $(MAKEFLAGS) | grep -e -j > /dev/null; then \
echo Warning: parallel make used serial dependencies >&2; \
cp serdep.par serdep.tmp; \
fi
Makefile: serdep.tmp
Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile.tpl
--- Makefile.tpl 28 Dec 2002 16:24:47 -0000 1.26
+++ Makefile.tpl 28 Dec 2002 21:00:12 -0000
@@ -641,7 +641,7 @@ local-clean:
local-distclean:
-rm -f Makefile config.status config.cache mh-frag mt-frag
- -rm -f multilib.out multilib.ts multilib.tmp maybedep.tmp serdep.tmp
+ -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp
-if [ "$(TARGET_SUBDIR)" != "." ]; then \
rm -rf $(TARGET_SUBDIR); \
else true; fi
@@ -789,9 +789,10 @@ TAGS: do-TAGS
[+ FOR build_modules +]
.PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
maybe-configure-build-[+module+]:
-configure-build-[+module+]: $(BUILD_SUBDIR)/[+module+]/Makefile
-$(BUILD_SUBDIR)/[+module+]/Makefile: config.status
- @[ -d $(BUILD_SUBDIR)/[+module+] ] || mkdir $(BUILD_SUBDIR)/[+module+];\
+configure-build-[+module+]:
+ @test ! -f $(BUILD_SUBDIR)/[+module+]/Makefile || exit 0; \
+ [ -d $(BUILD_SUBDIR)/[+module+] ] || \
+ mkdir $(BUILD_SUBDIR)/[+module+];\
r=`${PWD}`; export r; \
s=`cd $(srcdir); ${PWD}`; export s; \
AR="$(AR_FOR_BUILD)"; export AR; \
@@ -862,10 +863,9 @@ all-build-[+module+]: configure-build-[+
[+ FOR host_modules +]
.PHONY: configure-[+module+] maybe-configure-[+module+]
maybe-configure-[+module+]:
-configure-[+module+]: [+module+]/Makefile
-
-[+module+]/Makefile: config.status
- @[ -d [+module+] ] || mkdir [+module+]; \
+configure-[+module+]:
+ @test ! -f [+module+]/Makefile || exit 0; \
+ [ -d [+module+] ] || mkdir [+module+]; \
r=`${PWD}`; export r; \
s=`cd $(srcdir); ${PWD}`; export s; \
CC="$(CC)"; export CC; \
@@ -964,15 +964,18 @@ install-[+module+]: installdirs
[+ FOR target_modules +]
.PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
maybe-configure-target-[+module+]:
-configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/Makefile
# There's only one multilib.out. Cleverer subdirs shouldn't need it copied.
$(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out
- @[ -d $(TARGET_SUBDIR)/[+module+] ] || mkdir $(TARGET_SUBDIR)/[+module+];\
+ @[ -d $(TARGET_SUBDIR)/[+module+] ] || \
+ mkdir $(TARGET_SUBDIR)/[+module+]; \
+ rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \
cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out
-$(TARGET_SUBDIR)/[+module+]/Makefile: config.status $(TARGET_SUBDIR)/[+module+]/multilib.out
- @[ -d $(TARGET_SUBDIR)/[+module+] ] || mkdir $(TARGET_SUBDIR)/[+module+];\
+configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out
+ @test ! -f $(TARGET_SUBDIR)/[+module+]/Makefile || exit 0; \
+ [ -d $(TARGET_SUBDIR)/[+module+] ] || \
+ mkdir $(TARGET_SUBDIR)/[+module+];\
r=`${PWD}`; export r; \
s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
@@ -1092,10 +1095,9 @@ install-target-[+module+]: installdirs
# gcc is the only module which uses GCC_FLAGS_TO_PASS.
.PHONY: configure-gcc maybe-configure-gcc
maybe-configure-gcc:
-configure-gcc: gcc/Makefile
-
-gcc/Makefile: config.status
- @[ -d gcc ] || mkdir gcc; \
+configure-gcc:
+ @test ! -f gcc/Makefile || exit 0; \
+ [ -d gcc ] || mkdir gcc; \
r=`${PWD}`; export r; \
s=`cd $(srcdir); ${PWD}`; export s; \
CC="$(CC)"; export CC; \
@@ -1395,17 +1397,11 @@ configure-target-qthreads: $(ALL_GCC_C)
# work around various timestamp bugs on some systems.
# We use move-if-change so that it's only considered updated when it
# actually changes, because it has to depend on a phony target.
-multilib.out: multilib.ts
- @if [ -f multilib.out ] ; then : else \
- rm -f multilib.ts; $(MAKE) multilib.ts; \
- fi
-
-multilib.ts: maybe-all-gcc
+multilib.out: maybe-all-gcc
@r=`${PWD}`; export r; \
echo "Checking multilib configuration..."; \
$(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \
$(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \
- echo timestamp > multilib.ts
# Rebuilding Makefile.in, using autogen.
AUTOGEN = autogen
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.202
diff -u -p -r1.202 configure.in
--- configure.in 28 Dec 2002 17:57:14 -0000 1.202
+++ configure.in 28 Dec 2002 21:00:13 -0000
@@ -1686,6 +1686,7 @@ esac
# Create the 'maybe dependencies'. This uses a temporary file.
rm -f maybedep.tmp
+echo '# maybedep.tmp' > maybedep.tmp
for item in ${all_build_modules} ${all_host_modules} ${all_target_modules} \
${install_host_modules} ${install_target_modules} \
${configure_build_modules} ${configure_host_modules} ${configure_target_modules} \
@@ -1700,27 +1701,34 @@ AC_SUBST_FILE(maybe_dependencies)
# These force 'configure's to be done one at a time, to avoid problems
# with contention over a shared config.cache.
rm -f serdep.tmp
+echo '# serdep.tmp' > serdep.tmp
olditem=
+test "x${enable_serial_configure}" = xno ||
+test "x${enable_serial_build_configure}" = xno ||
for item in ${build_configdirs} ; do
case ${olditem} in
"") ;;
- *) echo "\$(BUILD_SUBDIR)/${item}/Makefile: \$(BUILD_SUBDIR)/${olditem}/Makefile" >> serdep.tmp ;;
+ *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
esac
olditem=${item}
done
olditem=
+test "x${enable_serial_configure}" = xno ||
+test "x${enable_serial_host_configure}" = xno ||
for item in ${configdirs} ; do
case ${olditem} in
"") ;;
- *) echo "${item}/Makefile: ${olditem}/Makefile" >> serdep.tmp ;;
+ *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
esac
olditem=${item}
done
olditem=
+test "x${enable_serial_configure}" = xno ||
+test "x${enable_serial_target_configure}" = xno ||
for item in ${target_configdirs} ; do
case ${olditem} in
"") ;;
- *) echo "\$(TARGET_SUBDIR)/${item}/Makefile: \$(TARGET_SUBDIR)/${olditem}/Makefile" >> serdep.tmp ;;
+ *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
esac
olditem=${item}
done
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer