This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

Toplevel configury patch 1/n (general cleanup/rearrangement)


This is in preparation for cleaning up the 'do-*' target in Makefile.tpl,
and various other cleanups.

The 'maybe dependencies' are easier to maintain and more robust than the
target lists, so I made their code independent of the target list generation,
and I intend to remove most or all of the target list generation in a subsequent
patch.  This also pulls out the list of build modules into a parallel location 
to the other lists.

Tested on i686-pc-linux-gnu via 
../gcc/configure
make configure-host
make all-host
make configure-target
make all-target

(which exercises the changed portions).

	* configure.in: Switch more things to use maybe dependencies.
	Rearrange a little.
	* configure: Regenerate.
	* Makefile.tpl: Switch more things to use maybe dependencies.
	* Makefile.in: Regenerate.

Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.45
diff -u -r1.45 Makefile.tpl
--- Makefile.tpl	3 May 2003 01:29:02 -0000	1.45
+++ Makefile.tpl	13 May 2003 19:13:38 -0000
@@ -554,8 +554,16 @@
 
 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
 
-configure-host: @configure_host_modules@
-configure-target: @configure_target_modules@
+.PHONY: configure-host
+configure-host: maybe-configure-gcc [+
+  FOR host_modules +] \
+    maybe-configure-[+module+][+
+  ENDFOR host_modules +]
+.PHONY: configure-target
+configure-target: [+
+  FOR target_modules +] \
+    maybe-configure-target-[+module+][+
+  ENDFOR target_modules +]
 
 # This is a list of the targets for which we can do a clean-{target}.
 CLEAN_MODULES =[+
@@ -578,14 +586,19 @@
 	clean-[+module+] [+ ENDIF with_x +][+ ENDFOR host_modules +]
 
 # The target built for a native build.
-# This list only includes modules actually being configured and built.
 .PHONY: all.normal
-all.normal: @all_build_modules@ \
-	@all_host_modules@ \
-	@all_target_modules@
+all.normal: @all_build_modules@ all-host all-target
 
-all-host: @all_host_modules@
-all-target: @all_target_modules@
+.PHONY: all-host
+all-host: maybe-all-gcc [+
+  FOR host_modules +] \
+    maybe-all-[+module+][+
+  ENDFOR host_modules +]
+.PHONY: all-target
+all-target: [+
+  FOR target_modules +] \
+    maybe-all-target-[+module+][+
+  ENDFOR target_modules +]
 
 # Do a target for all the subdirectories.  A ``make do-X'' will do a
 # ``make X'' in all subdirectories (because, in general, there is a
@@ -757,9 +770,18 @@
 # Installation targets.
 
 .PHONY: install uninstall
-install: installdirs @install_host_modules@ @install_target_modules@
+install: installdirs install-host install-target
 
-install-target: @install_target_modules@
+.PHONY: install-host
+install-host: maybe-install-gcc [+
+  FOR host_modules +] \
+    maybe-install-[+module+][+
+  ENDFOR host_modules +]
+.PHONY: install-target
+install-target: [+
+  FOR target_modules +] \
+    maybe-install-target-[+module+][+
+  ENDFOR target_modules +]
 
 uninstall:
 	@echo "the uninstall target is not supported in this tree"
@@ -779,7 +801,7 @@
 # the fixed header files.
 .PHONY: install-no-fixedincludes
 install-no-fixedincludes: installdirs @install_host_modules_nogcc@ \
-	@install_target_modules@ gcc-no-fixedincludes
+	install-target gcc-no-fixedincludes
 
 ### other supporting targets
 
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.232
diff -u -r1.232 configure.in
--- configure.in	13 May 2003 08:58:24 -0000	1.232
+++ configure.in	13 May 2003 19:13:40 -0000
@@ -164,6 +164,16 @@
 configdirs=`echo ${host_libs} ${host_tools}`
 target_configdirs=`echo ${target_libs} ${target_tools}`
 
+# Only make build modules if build != host.
+# This should be done more generally, but at the moment it doesn't matter.
+if test ${host_alias} != ${build_alias} ; then
+  # This is the only build module.
+  build_modules=libiberty
+else
+  build_modules=
+fi
+
+
 ################################################################################
 
 srcname="gnu development package"
@@ -1604,59 +1614,27 @@
 target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
 
 # This is the final value for target_configdirs.  configdirs already
-# has its final value.  It's time to create some lists of valid targets.
-
-# While at that, we remove Makefiles if we were started for recursive
-# configuration, such that the top-level Makefile reconfigures them,
-# like we used to do when configure itself was recursive.
+# has its final value, as does build_modules.  It's time to create some 
+# lists of valid targets.
 
 all_build_modules=
 configure_build_modules=
-# Only make build modules if build != host.
-# This should be done more generally, but at the moment it doesn't matter.
-if test ${host_alias} != ${build_alias} ; then
-  for module in libiberty ; do
-    all_build_modules=all-build-${module}
-    configure_build_modules=configure-build-${module}
-    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
-  done
-fi
+for module in ${build_modules} ; do
+  all_build_modules=all-build-${module}
+  configure_build_modules=configure-build-${module}
+done
 
-all_host_modules=
 check_host_modules=
 install_host_modules=
-configure_host_modules=
 for module in ${configdirs} ; do
-  all_host_modules="${all_host_modules} all-${module}"
   check_host_modules="${check_host_modules} check-${module}"
   install_host_modules="${install_host_modules} install-${module}"
-  configure_host_modules="${configure_host_modules} configure-${module}"
-  if test -z "${no_recursion}" \
-     && test -f ${module}/Makefile; then
-    echo 1>&2 "*** removing ${module}/Makefile to force reconfigure"
-    rm -f ${module}/Makefile
-  fi
 done
 install_host_modules_nogcc=`echo "${install_host_modules}" | sed -e 's/install-gcc//g'`
 
-all_target_modules=
 check_target_modules=
-install_target_modules=
-configure_target_modules=
 for module in ${target_configdirs} ; do
-  all_target_modules="${all_target_modules} all-target-${module}"
   check_target_modules="${check_target_modules} check-target-${module}"
-  install_target_modules="${install_target_modules} install-target-${module}"
-  configure_target_modules="${configure_target_modules} configure-target-${module}"
-  if test -z "${no_recursion}" \
-     && test -f ${target_subdir}/${module}/Makefile; then
-    echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
-    rm -f ${target_subdir}/${module}/Makefile
-  fi
 done
 
 # Determine whether gdb needs tk/tcl or not.
@@ -1686,13 +1664,49 @@
 esac
 
 # Create the 'maybe dependencies'.  This uses a temporary file.
+
+# 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
-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} \
-	; do
-  echo "maybe-${item}: ${item}" >> maybedep.tmp
+
+# Make-targets which may need maybe dependencies.
+mts="configure all install"
+
+# 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
+done
+for module in ${configdirs} ; do
+  if test -z "${no_recursion}" \
+     && test -f ${module}/Makefile; then
+    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
+done
+for module in ${target_configdirs} ; do
+  if test -z "${no_recursion}" \
+     && test -f ${target_subdir}/${module}/Makefile; then
+    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
 done
 maybe_dependencies=maybedep.tmp
 AC_SUBST_FILE(maybe_dependencies)
@@ -1985,20 +1999,14 @@
 # Host module lists & subconfigure args.
 AC_SUBST(host_configargs)
 AC_SUBST(configdirs)
-AC_SUBST(configure_host_modules)
-AC_SUBST(all_host_modules)
 AC_SUBST(check_host_modules)
-AC_SUBST(install_host_modules)
 AC_SUBST(install_host_modules_nogcc)
 
 # Target module lists & subconfigure args.
 AC_SUBST(target_subdir)
 AC_SUBST(target_configargs)
 AC_SUBST(target_configdirs)
-AC_SUBST(configure_target_modules)
-AC_SUBST(all_target_modules)
 AC_SUBST(check_target_modules)
-AC_SUBST(install_target_modules)
 
 # Build tools.
 AC_SUBST(BISON)


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