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 patch) Real targets for make.


This is the exciting patch which puts real targets in the top level Makefile,
and accordingly allows great simplification in the configure-* targets.

It looks scary (although it is actually pretty safe), so I checked it quite 
thoroughly.

Checked as follows:
-- gcc bootstrap on i686-pc-linux-gnu -- OK
-- in-source gcc bootstrap on i686-pc-linux-gnu -- OK
-- combined gcc & src bootstrap on i686-pc-linux-gnu -- OK

-- combined gcc & src cross to powerpc-eabisim -- OK
-- Using produced tools, gcc crossbuilt native for powerpc-eabisim
  -- worked as well as it did before (I haven't quite got the hang of
     building these yet)

Again, this is for gcc 3.4b-i-b and will hit src only when that branch lands.

	* Makefile.tpl: Make configure-target-* and configure-build-* depend
	on real targets */Makefile, and simplify embedded code.  Remove
	more unnecessary ifs and reformat.
	* configure.in: Set $(BASE_CC_FOR_TARGET) so it can be used as
	a dependency for */multilib.out.
	* Makefile.in: Regenerate.

Next patch after this should be the one to configure host subdirs in the 
Makefile, unless I get distracted by other cleanups, or see a good way to 
clean up the 'configure' targets further before creating more of them.  That 
change -- configuring host subdirs in the Makefile -- is the last serious 
change needed before autoconfiscation, and probably the most destablizing.  
(The autoconfiscation itself will probably be relatively safe.)

--- configure.in	23 Nov 2002 23:33:59 -0000	1.177.4.10
+++ configure.in	26 Nov 2002 20:21:49 -0000
@@ -1611,6 +1611,12 @@
 qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'`
 qqRAW_CXX_FOR_TARGET=`echo "$qRAW_CXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'`
 
+# BASE_CC_FOR_TARGET is the actual program file of CC_FOR_TARGET, or
+# at least the first word of CC_FOR_TARGET.  Replace $$r with a relative
+# spec if it's present.
+set dummy $CC_FOR_TARGET; cc_for_target_first_word=$2
+BASE_CC_FOR_TARGET=`echo "$cc_for_target_first_word" | sed -e 's,[$][$]r,.,'`
+
 sedtemp=sed.$$
 cat >$sedtemp <<EOF
 s%@GDB_TK@%${GDB_TK}%
@@ -1627,6 +1633,7 @@
 s%@target_configargs@%${targargs}%
 s%@FLAGS_FOR_TARGET@%${FLAGS_FOR_TARGET}%
 s%@CC_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}%
+s%@BASE_CC_FOR_TARGET@%${BASE_CC_FOR_TARGET}%
 s%@GCJ_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}%
 s%@CXX_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}%
 s%@RAW_CXX_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${qRAW_CXX_FOR_TARGET}%
Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.5.2.17
diff -u -r1.5.2.17 Makefile.tpl
--- Makefile.tpl	26 Nov 2002 20:07:21 -0000	1.5.2.17
+++ Makefile.tpl	27 Nov 2002 06:48:57 -0000
@@ -255,6 +255,7 @@
 # Should be substed by configure.in
 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
 CC_FOR_TARGET = @CC_FOR_TARGET@
+BASE_CC_FOR_TARGET = @BASE_CC_FOR_TARGET@
 CXX_FOR_TARGET = @CXX_FOR_TARGET@
 RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
 CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
@@ -796,85 +797,70 @@
 .PHONY: all-build-[+module+] maybe-all-build-[+module+]
 maybe-all-build-[+module+]:
 all-build-[+module+]:
-	@if [ -f ./[+module+]/Makefile ] ; then \
-	  r=`${PWD}`; export r; \
-	  s=`cd $(srcdir); ${PWD}`; export s; \
-	  (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all); \
-	else \
-	  true; \
-	fi
+	@r=`${PWD}`; export r; \
+	s=`cd $(srcdir); ${PWD}`; export s; \
+	cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all
 
 .PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
 maybe-configure-build-[+module+]:
-configure-build-[+module+]:
-	@if [ ! -d $(BUILD_SUBDIR) ]; then \
-	  true; \
-	elif [ -f $(BUILD_SUBDIR)/[+module+]/Makefile ] ; then \
-	  true; \
-	elif echo " $(BUILD_CONFIGDIRS) " | grep " [+module+] " >/dev/null 2>&1; then \
-	  if [ -d $(srcdir)/[+module+] ]; then \
-	    [ -d $(BUILD_SUBDIR)/[+module+] ] || mkdir $(BUILD_SUBDIR)/[+module+];\
-	    r=`${PWD}`; export r; \
-	    s=`cd $(srcdir); ${PWD}`; export s; \
-	    AR="$(AR_FOR_BUILD)"; export AR; \
-	    AS="$(AS_FOR_BUILD)"; export AS; \
-	    CC="$(CC_FOR_BUILD)"; export CC; \
-	    CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
-	    CXX="$(CXX_FOR_BUILD)"; export CXX; \
-	    CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
-	    GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
-	    DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
-	    LD="$(LD_FOR_BUILD)"; export LD; \
-            LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
-	    NM="$(NM_FOR_BUILD)"; export NM; \
-	    RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
-	    WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
-	    echo Configuring in $(BUILD_SUBDIR)/[+module+]; \
-	    cd "$(BUILD_SUBDIR)/[+module+]" || exit 1; \
-	    case $(srcdir) in \
-	    /* | [A-Za-z]:[\\/]*) \
-	      topdir=$(srcdir) ;; \
-	    *) \
-	      case "$(BUILD_SUBDIR)" in \
-	      .) topdir="../$(srcdir)" ;; \
-	      *) topdir="../../$(srcdir)" ;; \
-	      esac ;; \
-	    esac; \
-	    if [ "$(srcdir)" = "." ] ; then \
-	      if [ "$(BUILD_SUBDIR)" != "." ] ; then \
-		if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
-		  if [ -f Makefile ]; then \
-		    if $(MAKE) distclean; then \
-		      true; \
-		    else \
-		      exit 1; \
-		    fi; \
-		  else \
-		    true; \
-		  fi; \
+configure-build-[+module+]: $(BUILD_SUBDIR)/[+module+]/Makefile
+$(BUILD_SUBDIR)/[+module+]/Makefile: config.status
+	@[ -d $(BUILD_SUBDIR)/[+module+] ] || mkdir $(BUILD_SUBDIR)/[+module+];\
+	r=`${PWD}`; export r; \
+	s=`cd $(srcdir); ${PWD}`; export s; \
+	AR="$(AR_FOR_BUILD)"; export AR; \
+	AS="$(AS_FOR_BUILD)"; export AS; \
+	CC="$(CC_FOR_BUILD)"; export CC; \
+	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
+	CXX="$(CXX_FOR_BUILD)"; export CXX; \
+	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
+	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
+	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
+	LD="$(LD_FOR_BUILD)"; export LD; \
+	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
+	NM="$(NM_FOR_BUILD)"; export NM; \
+	RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
+	WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
+	echo Configuring in $(BUILD_SUBDIR)/[+module+]; \
+	cd "$(BUILD_SUBDIR)/[+module+]" || exit 1; \
+	case $(srcdir) in \
+	/* | [A-Za-z]:[\\/]*) \
+	  topdir=$(srcdir) ;; \
+	*) \
+	  case "$(BUILD_SUBDIR)" in \
+	  .) topdir="../$(srcdir)" ;; \
+	  *) topdir="../../$(srcdir)" ;; \
+	  esac ;; \
+	esac; \
+	if [ "$(srcdir)" = "." ] ; then \
+	  if [ "$(BUILD_SUBDIR)" != "." ] ; then \
+	    if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
+	      if [ -f Makefile ]; then \
+		if $(MAKE) distclean; then \
+		  true; \
 		else \
 		  exit 1; \
 		fi; \
-	      else \
+		  else \
 		true; \
 	      fi; \
-	      srcdiroption="--srcdir=."; \
-	      libsrcdir="."; \
 	    else \
-	      srcdiroption="--srcdir=$${topdir}/[+module+]"; \
-	      libsrcdir="$$s/[+module+]"; \
+	      exit 1; \
 	    fi; \
-	    rm -f no-such-file || : ; \
-	    CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
-	      $(BUILD_CONFIGARGS) $${srcdiroption} \
-	      --with-build-subdir="$(BUILD_SUBDIR)" \
-	      || exit 1; \
 	  else \
 	    true; \
 	  fi; \
+	  srcdiroption="--srcdir=."; \
+	  libsrcdir="."; \
 	else \
-	  true; \
-	fi
+	  srcdiroption="--srcdir=$${topdir}/[+module+]"; \
+	  libsrcdir="$$s/[+module+]"; \
+	fi; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(BUILD_CONFIGARGS) $${srcdiroption} \
+	  --with-build-subdir="$(BUILD_SUBDIR)" \
+	  || exit 1
 [+ ENDFOR build_modules +]
 
 # These rules are used to build the modules which use FLAGS_TO_PASS.  To
@@ -942,88 +928,75 @@
 [+ FOR target_modules +]
 .PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
 maybe-configure-target-[+module+]:
-configure-target-[+module+]:
-	@r=`${PWD}`; export r; \
-	  $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/[+module+]/tmpmulti.out 2> /dev/null; \
-	  if [ -s $(TARGET_SUBDIR)/[+module+]/tmpmulti.out ]; then \
-	    if [ -f $(TARGET_SUBDIR)/[+module+]/multilib.out ]; then \
-	      if cmp $(TARGET_SUBDIR)/[+module+]/multilib.out $(TARGET_SUBDIR)/[+module+]/tmpmulti.out > /dev/null; then \
-		rm -f $(TARGET_SUBDIR)/[+module+]/tmpmulti.out; \
-	      else \
-		echo "Multilibs changed for [+module+], reconfiguring"; \
-		rm -f $(TARGET_SUBDIR)/[+module+]/multilib.out $(TARGET_SUBDIR)/[+module+]/Makefile; \
-		mv $(TARGET_SUBDIR)/[+module+]/tmpmulti.out $(TARGET_SUBDIR)/[+module+]/multilib.out; \
-	      fi; \
-	    else \
-	      mv $(TARGET_SUBDIR)/[+module+]/tmpmulti.out $(TARGET_SUBDIR)/[+module+]/multilib.out; \
-	    fi; \
-	fi; exit 0	# break command into two pieces
-	@if [ -d $(srcdir)/[+module+] ]; then \
-	    [ -d $(TARGET_SUBDIR)/[+module+] ] || mkdir $(TARGET_SUBDIR)/[+module+];\
-	    r=`${PWD}`; export r; \
-	    s=`cd $(srcdir); ${PWD}`; export s; \
-	    $(SET_LIB_PATH) \
-	    AR="$(AR_FOR_TARGET)"; export AR; \
-	    AS="$(AS_FOR_TARGET)"; export AS; \
-	    CC="$(CC_FOR_TARGET)"; export CC; \
-	    CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \[+ 
-	IF raw_cxx +]
-	    CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
-	    CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \[+ 
-	ELSE normal_cxx +]
-	    CXX="$(CXX_FOR_TARGET)"; export CXX; \[+ 
-	ENDIF raw_cxx +]
-	    CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
-	    GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
-	    DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
-	    LD="$(LD_FOR_TARGET)"; export LD; \
-            LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
-	    NM="$(NM_FOR_TARGET)"; export NM; \
-	    RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
-	    WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
-	    echo Configuring in $(TARGET_SUBDIR)/[+module+]; \
-	    cd "$(TARGET_SUBDIR)/[+module+]" || exit 1; \
-	    case $(srcdir) in \
-	    /* | [A-Za-z]:[\\/]*) \
-	      topdir=$(srcdir) ;; \
-	    *) \
-	      case "$(TARGET_SUBDIR)" in \
-	      .) topdir="../$(srcdir)" ;; \
-	      *) topdir="../../$(srcdir)" ;; \
-	      esac ;; \
-	    esac; \
-	    if [ "$(srcdir)" = "." ] ; then \
-	      if [ "$(TARGET_SUBDIR)" != "." ] ; then \
-		if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
-		  if [ -f Makefile ]; then \
-		    if $(MAKE) distclean; then \
-		      true; \
-		    else \
-		      exit 1; \
-		    fi; \
-		  else \
-		    true; \
-		  fi; \
-		else \
-		  exit 1; \
-		fi; \
+configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/Makefile
+$(TARGET_SUBDIR)/[+module+]/multilib.out: $(BASE_CC_FOR_TARGET)
+	@[ -d $(TARGET_SUBDIR)/[+module+] ] || mkdir $(TARGET_SUBDIR)/[+module+];\
+	r=`${PWD}`; export r; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/[+module+]/multilib.out 2> /dev/null
+
+$(TARGET_SUBDIR)/[+module+]/Makefile: config.status $(TARGET_SUBDIR)/[+module+]/multilib.out
+	@[ -d $(TARGET_SUBDIR)/[+module+] ] || mkdir $(TARGET_SUBDIR)/[+module+];\
+	r=`${PWD}`; export r; \
+	s=`cd $(srcdir); ${PWD}`; export s; \
+	$(SET_LIB_PATH) \
+	AR="$(AR_FOR_TARGET)"; export AR; \
+	AS="$(AS_FOR_TARGET)"; export AS; \
+	CC="$(CC_FOR_TARGET)"; export CC; \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \[+ 
+IF raw_cxx +]
+	CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
+	CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \[+ 
+ELSE normal_cxx +]
+	CXX="$(CXX_FOR_TARGET)"; export CXX; \[+ 
+ENDIF raw_cxx +]
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
+	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
+	LD="$(LD_FOR_TARGET)"; export LD; \
+	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
+	NM="$(NM_FOR_TARGET)"; export NM; \
+	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
+	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
+	echo Configuring in $(TARGET_SUBDIR)/[+module+]; \
+	cd "$(TARGET_SUBDIR)/[+module+]" || exit 1; \
+	case $(srcdir) in \
+	/* | [A-Za-z]:[\\/]*) \
+	  topdir=$(srcdir) ;; \
+	*) \
+	  case "$(TARGET_SUBDIR)" in \
+	  .) topdir="../$(srcdir)" ;; \
+	  *) topdir="../../$(srcdir)" ;; \
+	  esac ;; \
+	esac; \
+	if [ "$(srcdir)" = "." ] ; then \
+	  if [ "$(TARGET_SUBDIR)" != "." ] ; then \
+	    if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
+	      if [ -f Makefile ]; then \
+	        if $(MAKE) distclean; then \
+	          true; \
+	        else \
+	          exit 1; \
+	        fi; \
 	      else \
 		true; \
 	      fi; \
-	      srcdiroption="--srcdir=."; \
-	      libsrcdir="."; \
 	    else \
-	      srcdiroption="--srcdir=$${topdir}/[+module+]"; \
-	      libsrcdir="$$s/[+module+]"; \
+	      exit 1; \
 	    fi; \
-	    rm -f no-such-file || : ; \
-	    CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
-	      $(TARGET_CONFIGARGS) $${srcdiroption} \
-	      --with-target-subdir="$(TARGET_SUBDIR)" \
-	      || exit 1; \
 	  else \
 	    true; \
-	  fi
+	  fi; \
+	  srcdiroption="--srcdir=."; \
+	  libsrcdir="."; \
+	else \
+	  srcdiroption="--srcdir=$${topdir}/[+module+]"; \
+	  libsrcdir="$$s/[+module+]"; \
+	fi; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) $${srcdiroption} \
+	  --with-target-subdir="$(TARGET_SUBDIR)" \
+	  || exit 1
 
 .PHONY: all-target-[+module+] maybe-all-target-[+module+]
 maybe-all-target-[+module+]:


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