This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] generate maybe dependencies from the template
- From: Paolo Bonzini <paolo dot bonzini at polimi dot it>
- To: Nathanael Nerode <neroden at twcny dot rr dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 May 2004 10:42:17 +0200
- Subject: Re: [RFC] generate maybe dependencies from the template
- References: <40A26EA1.6070204@gnu.org> <40A514EF.80702@twcny.rr.com> <40A71326.8030905@gnu.org> <40A785A4.4020204@twcny.rr.com>
OK, "two". :-)
:-)
Is the patch ok with a comment warning about this (see the attached patch)?
Paolo
2004-05-12 Paolo Bonzini <bonzini@gnu.org>
* Makefile.tpl: Whenever a recursive target is defined, wrap
it in a special @if/@endif block, and prepare its maybe
dependency in the @if/@endif block
* configure.in: Instead of writing maybe dependencies, remove
the @if/@endif statements, and remove the @if/@endif blocks
that remain.
* configure: Regenerate.
Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.95
diff -u -r1.95 Makefile.tpl
--- Makefile.tpl 13 May 2004 06:39:06 -0000 1.95
+++ Makefile.tpl 17 May 2004 07:25:20 -0000
@@ -697,6 +697,8 @@
[+ FOR build_modules +]
.PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
maybe-configure-build-[+module+]:
+@if [+module+]
+maybe-configure-build-[+module+]: configure-build-[+module+]
configure-build-[+module+]:
@test ! -f $(BUILD_SUBDIR)/[+module+]/Makefile || exit 0; \
$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/[+module+] ; \
@@ -757,13 +759,17 @@
$(BUILD_CONFIGARGS) $${srcdiroption} \
--with-build-subdir="$(BUILD_SUBDIR)" \
|| exit 1
+@endif [+module+]
.PHONY: all-build-[+module+] maybe-all-build-[+module+]
maybe-all-build-[+module+]:
+@if [+module+]
+maybe-all-build-[+module+]: all-build-[+module+]
all-build-[+module+]: configure-build-[+module+]
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
(cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all)
+@endif [+module+]
[+ ENDFOR build_modules +]
# --------------------------------------
@@ -772,6 +778,8 @@
[+ FOR host_modules +]
.PHONY: configure-[+module+] maybe-configure-[+module+]
maybe-configure-[+module+]:
+@if [+module+]
+maybe-configure-[+module+]: configure-[+module+]
configure-[+module+]:
@test ! -f [+module+]/Makefile || exit 0; \
[ -d [+module+] ] || mkdir [+module+]; \
@@ -809,9 +817,12 @@
$(SHELL) $${libsrcdir}/configure \
$(HOST_CONFIGARGS) $${srcdiroption} \
|| exit 1
+@endif [+module+]
.PHONY: all-[+module+] maybe-all-[+module+]
maybe-all-[+module+]:
+@if [+module+]
+maybe-all-[+module+]: all-[+module+]
all-[+module+]: configure-[+module+]
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@@ -820,9 +831,12 @@
IF with_x
+] $(X11_FLAGS_TO_PASS)[+
ENDIF with_x +] all)
+@endif [+module+]
.PHONY: check-[+module+] maybe-check-[+module+]
maybe-check-[+module+]:
+@if [+module+]
+maybe-check-[+module+]: check-[+module+]
[+ IF no_check +]
check-[+module+]:
[+ ELIF no_check_cross +]
@@ -847,9 +861,12 @@
+] $(X11_FLAGS_TO_PASS)[+
ENDIF with_x +] check)
[+ ENDIF no_check +]
+@endif [+module+]
.PHONY: install-[+module+] maybe-install-[+module+]
maybe-install-[+module+]:
+@if [+module+]
+maybe-install-[+module+]: install-[+module+]
[+ IF no_install +]
install-[+module+]:
[+ ELSE install +]
@@ -862,11 +879,14 @@
+] $(X11_FLAGS_TO_PASS)[+
ENDIF with_x +] install)
[+ ENDIF no_install +]
+@endif [+module+]
# Other targets (info, dvi, etc.)
[+ FOR recursive_targets +]
.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
maybe-[+make_target+]-[+module+]:
+@if [+module+]
+maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
[+ IF (match-value? = "missing" (get "make_target") ) +]
# [+module+] doesn't support [+make_target+].
[+make_target+]-[+module+]:
@@ -891,6 +911,7 @@
[+make_target+]) \
|| exit 1
[+ ENDIF +]
+@endif [+module+]
[+ ENDFOR recursive_targets +]
[+ ENDFOR host_modules +]
@@ -900,6 +921,8 @@
[+ FOR target_modules +]
.PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
maybe-configure-target-[+module+]:
+@if [+module+]
+maybe-configure-target-[+module+]: configure-target-[+module+]
# There's only one multilib.out. Cleverer subdirs shouldn't need it copied.
$(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out
@@ -974,9 +997,12 @@
$(TARGET_CONFIGARGS) $${srcdiroption} \
--with-target-subdir="$(TARGET_SUBDIR)" \
|| exit 1
+@endif [+module+]
.PHONY: all-target-[+module+] maybe-all-target-[+module+]
maybe-all-target-[+module+]:
+@if [+module+]
+maybe-all-target-[+module+]: all-target-[+module+]
all-target-[+module+]: configure-target-[+module+]
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@@ -987,9 +1013,12 @@
+] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
ENDIF raw_cxx
+] all)
+@endif [+module+]
.PHONY: check-target-[+module+] maybe-check-target-[+module+]
maybe-check-target-[+module+]:
+@if [+module+]
+maybe-check-target-[+module+]: check-target-[+module+]
[+ IF no_check +]
# Dummy target for uncheckable module.
check-target-[+module+]:
@@ -1005,9 +1034,12 @@
ENDIF raw_cxx
+] check)
[+ ENDIF no_check +]
+@endif [+module+]
.PHONY: install-target-[+module+] maybe-install-target-[+module+]
maybe-install-target-[+module+]:
+@if [+module+]
+maybe-install-target-[+module+]: install-target-[+module+]
[+ IF no_install +]
# Dummy target for uninstallable.
install-target-[+module+]:
@@ -1019,11 +1051,14 @@
(cd $(TARGET_SUBDIR)/[+module+] && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) install)
[+ ENDIF no_install +]
+@endif [+module+]
# Other targets (info, dvi, etc.)
[+ FOR recursive_targets +]
.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
maybe-[+make_target+]-target-[+module+]:
+@if [+module+]
+maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
[+ IF (match-value? = "missing" (get "make_target") ) +]
# [+module+] doesn't support [+make_target+].
[+make_target+]-target-[+module+]:
@@ -1048,6 +1083,7 @@
[+make_target+]) \
|| exit 1
[+ ENDIF +]
+@endif [+module+]
[+ ENDFOR recursive_targets +]
[+ ENDFOR target_modules +]
@@ -1067,6 +1103,8 @@
# We must skip configuring if toplevel bootstrap is going.
.PHONY: configure-gcc maybe-configure-gcc
maybe-configure-gcc:
+@if gcc
+maybe-configure-gcc: configure-gcc
configure-gcc:
@test ! -f gcc/Makefile || exit 0; \
[ -f stage_last ] && exit 0; \
@@ -1108,12 +1146,15 @@
$(SHELL) $${libsrcdir}/configure \
$(HOST_CONFIGARGS) $${srcdiroption} \
|| exit 1
+@endif gcc
# Don't 'make all' in gcc if it's already been made by 'bootstrap'; that
# causes trouble. This wart will be fixed eventually by moving
# the bootstrap behavior to this file.
.PHONY: all-gcc maybe-all-gcc
maybe-all-gcc:
+@if gcc
+maybe-all-gcc: all-gcc
all-gcc: configure-gcc
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@@ -1126,6 +1167,7 @@
$(SET_LIB_PATH) \
(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
fi
+@endif gcc
# Building GCC uses some tools for rebuilding "source" files
# like texinfo, bison/byacc, etc. So we must depend on those.
@@ -1203,6 +1245,8 @@
.PHONY: check-gcc maybe-check-gcc
maybe-check-gcc:
+@if gcc
+maybe-check-gcc: check-gcc
check-gcc:
@if [ -f ./gcc/Makefile ] ; then \
r=`${PWD_COMMAND}`; export r; \
@@ -1226,9 +1270,12 @@
.PHONY: check-c++
check-c++: check-target-libstdc++-v3 check-gcc-c++
+@endif gcc
.PHONY: install-gcc maybe-install-gcc
maybe-install-gcc:
+@if gcc
+maybe-install-gcc: install-gcc
install-gcc:
@if [ -f ./gcc/Makefile ] ; then \
r=`${PWD_COMMAND}`; export r; \
@@ -1238,6 +1285,7 @@
else \
true; \
fi
+@endif gcc
# Install the gcc headers files, but not the fixed include files,
# which Cygnus is not allowed to distribute. This rule is very
@@ -1264,6 +1312,8 @@
[+ FOR recursive_targets +]
.PHONY: maybe-[+make_target+]-gcc [+make_target+]-gcc
maybe-[+make_target+]-gcc:
+@if gcc
+maybe-[+make_target+]-gcc: [+make_target+]-gcc
[+make_target+]-gcc: [+
FOR depend +]\
[+depend+]-gcc [+
@@ -1283,6 +1333,7 @@
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
[+make_target+]) \
|| exit 1
+@endif gcc
[+ ENDFOR recursive_targets +]
@@ -1713,10 +1672,6 @@
configure-target-gperf: $(ALL_GCC_CXX)
all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3
configure-target-qthreads: $(ALL_GCC_C)
-
-# Dependencies of maybe-foo on foo. These are used because, for example,
-# all-gcc only depends on all-gas if gas is present and being configured.
-@maybe_dependencies@
# Serialization dependencies. Host configures don't work well in parallel to
# each other, due to contention over config.cache. Target configures and
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.286
diff -u -r1.286 configure.in
--- configure.in 13 May 2004 06:39:07 -0000 1.286
+++ configure.in 17 May 2004 07:25:20 -0000
@@ -1723,31 +1724,29 @@
;;
esac
-# Create the 'maybe dependencies'. This uses a temporary file.
+# Strip out unwanted targets.
# While at that, we remove Makefiles if we were started for recursive
# configuration, so that the top-level Makefile reconfigures them,
# like we used to do when configure itself was recursive.
-rm -f maybedep.tmp
-echo '# maybedep.tmp' > maybedep.tmp
-# Make-targets which may need maybe dependencies.
-mts="configure all install check clean distclean dvi info install-info"
-mts="${mts} installcheck mostlyclean maintainer-clean TAGS"
+# Loop over modules. $extrasub must be used with care, limiting as
+# much as possible the usage of range addresses. That's because autoconf
+# splits the sed script to overcome limits in the number of commands,
+# and relying on carefully-timed sed passes may turn out to be very hard
+# to maintain later. In this particular case, you just have to be careful
+# to nest @if/@endif pairs correctly, because if you make a nesting error
+# configure will not warn you at all."
-# Loop over modules and make-targets.
for module in ${build_modules} ; do
if test -z "${no_recursion}" \
&& test -f ${build_subdir}/${module}/Makefile; then
echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
rm -f ${build_subdir}/${module}/Makefile
fi
- for mt in ${mts} ; do
- case ${mt} in
- install) ;; # No installing build modules.
- *) echo "maybe-${mt}-build-${module}: ${mt}-build-${module}" >> maybedep.tmp ;;
- esac
- done
+ extrasub="$extrasub
+/^@if $module\$/d
+/^@endif $module\$/d"
done
for module in ${configdirs} ; do
if test -z "${no_recursion}" \
@@ -1755,9 +1754,9 @@
echo 1>&2 "*** removing ${module}/Makefile to force reconfigure"
rm -f ${module}/Makefile
fi
- for mt in ${mts} ; do
- echo "maybe-${mt}-${module}: ${mt}-${module}" >> maybedep.tmp
- done
+ extrasub="$extrasub
+/^@if $module\$/d
+/^@endif $module\$/d"
done
for module in ${target_configdirs} ; do
if test -z "${no_recursion}" \
@@ -1765,12 +1764,12 @@
echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
rm -f ${target_subdir}/${module}/Makefile
fi
- for mt in ${mts} ; do
- echo "maybe-${mt}-target-${module}: ${mt}-target-${module}" >> maybedep.tmp
- done
+ extrasub="$extrasub
+/^@if $module\$/d
+/^@endif $module\$/d"
done
-maybe_dependencies=maybedep.tmp
-AC_SUBST_FILE(maybe_dependencies)
+extrasub="$extrasub
+/^@if /,/^@endif /d"
# Create the serialization dependencies. This uses a temporary file.