This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] generate maybe dependencies from the template


This patch is a proposal for an alternative way to create maybe dependencies.

The advantages are a 30% (or more, e.g. if you're over NFS) speedup in config.status, removing the knowledge of makefile targets from the configure script, and setting up a framework which will also be used when a toplevel configure switch will enable toplevel bootstrapping.

There is a small behavioral change, in that a hard dependency on "all-TARGET" when the target is not available will cause make to abort, instead of trying and failing to execute the target

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.

diff -u gcc-save/Makefile.tpl gcc/Makefile.tpl
--- gcc-save/Makefile.tpl	2004-04-23 17:35:54.000000000 +0200
+++ gcc/Makefile.tpl	2004-05-12 20:04:03.000000000 +0200
@@ -695,6 +695,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+] ; \
@@ -754,13 +756,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 +]
 
 # --------------------------------------
@@ -769,6 +775,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+]; \
@@ -806,9 +814,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; \
@@ -817,9 +828,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 +]
@@ -844,9 +858,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 +]
@@ -859,11 +876,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+]:
@@ -888,6 +908,7 @@
 	          [+make_target+]) \
 	  || exit 1
 [+ ENDIF +]
+@endif [+module+]
 [+ ENDFOR recursive_targets +]
 [+ ENDFOR host_modules +]
 
@@ -897,6 +918,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
@@ -970,9 +993,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; \
@@ -983,9 +1009,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+]:
@@ -1001,9 +1030,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+]:
@@ -1015,11 +1047,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+]:
@@ -1044,6 +1079,7 @@
 	          [+make_target+]) \
 	  || exit 1
 [+ ENDIF +]
+@endif [+module+]
 [+ ENDFOR recursive_targets +]
 [+ ENDFOR target_modules +]
 
@@ -1063,6 +1099,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; \
@@ -1102,12 +1140,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; \
@@ -1120,6 +1161,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.
@@ -1197,6 +1239,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; \
@@ -1220,9 +1264,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; \
@@ -1232,6 +1279,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
@@ -1258,6 +1306,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 [+
@@ -1277,6 +1327,7 @@
 	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
 	          [+make_target+]) \
 	  || exit 1
+@endif gcc
 
 [+ ENDFOR recursive_targets +]
 
diff -u gcc-save/configure.in gcc/configure.in
--- gcc-save/configure.in	2004-04-23 15:34:44.000000000 +0200
+++ gcc/configure.in	2004-05-12 20:09:19.000000000 +0200
@@ -1623,17 +1623,11 @@
     ;;
 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 and make-targets.
 for module in ${build_modules} ; do
@@ -1642,12 +1636,9 @@
     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}" \
@@ -1655,9 +1646,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}" \
@@ -1665,12 +1656,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.
 




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]