configure: For in-source builds, make a subdir and re-exec there.

2002-06-18  Phil Edwards  <pme@gcc.gnu.org>

	* configure:  For in-source builds, make a subdir and re-exec there.
	* Makefile:  New file.  Pass targets through to build directory.
	* .cvsignore:  No longer ignore "Makefile".

From-SVN: r54759
This commit is contained in:
Phil Edwards 2002-06-18 20:02:21 +00:00
parent c985dc5e74
commit bb20b7dafd
4 changed files with 91 additions and 2 deletions

View file

@ -26,7 +26,6 @@ configure.tps
configure.vr
configure.vrs
dir.info
Makefile
lost+found
update.out
LAST_UPDATED

View file

@ -1,3 +1,9 @@
2002-06-18 Phil Edwards <pme@gcc.gnu.org>
* configure: For in-source builds, make a subdir and re-exec there.
* Makefile: New file. Pass targets through to build directory.
* .cvsignore: No longer ignore "Makefile".
2002-06-16 Douglas Rupp <rupp@gnat.com>
* MAINTAINERS (Write After Approval): Add self.

53
Makefile Normal file
View file

@ -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})

33
configure vendored
View file

@ -89,7 +89,7 @@ subdirs=
target_alias=NOTARGET
target_makefile_frag=
undefs=NOUNDEFS
version="$Revision: 1.42 $"
version="$Revision: 1.43 $"
x11=default
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
@ -573,6 +573,37 @@ case "${srcdir}" in
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