translating in-source builds, next round (was Re: gcc/gcc ChangeLog doc/install.texi)

Phil Edwards phil@jaj.com
Tue Jun 18 12:46:00 GMT 2002


On Wed, Apr 17, 2002 at 02:55:40PM -0700, Mark Mitchell wrote:
> 
> For GCC 3.2, we should leave that patch in, and work through Phil's
> efforts until we get something that works.  (Which may be Phil's most
> recent patch; hopefully we'll get that reviewed soon.)  Once we check in
> Phil's patch, we'll take out Loren's patch on the mainline, too -- since
> the standard build sequence will be supported using the new technology.
> 
[...]
> 
> Phil, if you get a patch you're happy with and it hasn't been reviewed
> when GCC 3.1 goes out, please let me know and I'll review it at that
> point.  I'm hoping Alexandre or D.J. -- who know the portability rules
> for /bin/sh better than I -- will review the patch before then.
> 
> Thanks to everyone for helping work through the issues.

Eeep.  Guess what slipped through the cracks (in my head).

Your announcement about the 3.2 deadline reminded me to refresh this patch.
It's freshly tested for both native and cross builds, and diffed against
the trunk.

As a reminder, the goals and questions were listed here:

    http://gcc.gnu.org/ml/gcc-patches/2002-04/msg01001.html


Index: configure
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/configure,v
retrieving revision 1.43
diff -u -3 -r1.43 configure
--- configure	31 May 2002 20:12:31 -0000	1.43
+++ configure	18 Jun 2002 19:23:49 -0000
@@ -573,6 +573,37 @@
 	fi
 esac
 
+# If it's an in-source build, make a directory and configure there instead.
+# Name the build directory after the host for clarity's sake.  Remember that
+# name for the redirecting makefile's use, since the makefile shouldn't have
+# to duplicate the work of figuring out host_alias.
+#
+# Also remember if this is a native build or not.  Variations on "or not"
+# are performed later in this script so we can't test them here.  In
+# particular, build_alias will still be empty unless specified by the user,
+# so do not try in-source builds when making a host-x-host compiler.
+# For a cross compile, "make all" = "all".  Otherwise, "all" = "bootstrap".
+if test "${srcdir}" = "." ; then
+	builddir=${host_alias}
+	if test ! -d ${builddir}; then
+		mkdir ${builddir} || exit 1
+	fi
+	if test ${host_alias} != ${target_alias}; then
+		t=all
+	else
+		t=bootstrap
+	fi
+	# stamp-builddir is too long for #$&!*@ 8.3 filesystems
+	echo "builddir=${builddir}" > s-buildd
+	echo "defaulttarget=$t" >> s-buildd
+	cd ${builddir}
+echo host $host_alias
+echo target $target_alias
+echo t $t
+sleep 20
+	exec ${config_shell} ../configure $arguments
+fi
+
 ### warn about some conflicting configurations.
 
 case "${srcdir}" in
Index: Makefile
===================================================================
RCS file: Makefile
diff -N Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Makefile	18 Jun 2002 19:15:08 -0000
@@ -0,0 +1,53 @@
+#
+# Redirecting Makefile.
+#   Copyright (C) 2002 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+# This Makefile is a red herring.  It is not normally used and it is never
+# written by 'configure' from 'Makefile.in'.  This Makefile is here to
+# support users who try to configure/build in the source directory.  It
+# simply chdir's into a subdirectory created by configure and reinvokes
+# make.  Few targets are listed because advanced users (who would use those
+# targets) are assumed to know that a separate build dir is recommended.
+
+SHELL = /bin/sh
+
+# Additional pass-through targets can be listed here.
+TARGETS=bootstrap \
+        clean \
+        install
+
+all:
+.PHONY: sanitycheck
+
+distclean:
+	test -f s-buildd || exit 0 &&  \
+	  . ./s-buildd && rm -rf $${builddir} s-buildd
+
+sanitycheck:
+	@if test ! -f s-buildd; then  \
+	  echo 'You must configure before attempting to build.';  \
+	  echo 'Please read the instructions in the INSTALL directory.';  \
+	  exit 1;  \
+	fi
+
+$(TARGETS): sanitycheck
+	(. ./s-buildd; cd $${builddir}; ${MAKE} $@)
+
+all: sanitycheck
+	(. ./s-buildd; cd $${builddir}; ${MAKE} $${defaulttarget})
+
Index: .cvsignore
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/.cvsignore,v
retrieving revision 1.5
diff -u -3 -r1.5 .cvsignore
--- .cvsignore	27 Jul 2001 06:00:45 -0000	1.5
+++ .cvsignore	18 Jun 2002 19:26:30 -0000
@@ -26,7 +26,6 @@
 configure.vr
 configure.vrs
 dir.info
-Makefile
 lost+found
 update.out
 LAST_UPDATED



More information about the Gcc-patches mailing list