From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10468 invoked by alias); 28 Nov 2002 01:21:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10445 invoked from network); 28 Nov 2002 01:21:02 -0000 Received: from unknown (HELO mailout5-0.nyroc.rr.com) (24.92.226.122) by sources.redhat.com with SMTP; 28 Nov 2002 01:21:02 -0000 Received: from doctormoo (syr-24-24-16-193.twcny.rr.com [24.24.16.193]) by mailout5-0.nyroc.rr.com (8.11.6/RoadRunner 1.20) with ESMTP id gAS1KxF23693; Wed, 27 Nov 2002 20:20:59 -0500 (EST) Received: from neroden by doctormoo with local (Exim 3.36 #1 (Debian)) id 18HDLt-0003mp-00; Wed, 27 Nov 2002 20:20:25 -0500 Date: Wed, 27 Nov 2002 17:21:00 -0000 To: gcc-patches@gcc.gnu.org, gdb-patches@sources.redhat.com, binutils@sources.redhat.com, dj@redhat.com Subject: (toplevel patch) Real targets for make. Message-ID: <20021128012024.GA14556@doctormoo> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i From: Nathanael Nerode X-SW-Source: 2002-11/txt/msg00695.txt.bz2 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 </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+]: