diff --git a/.cvsignore b/.cvsignore index e2952dc9ac3..9cd799e739a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -26,7 +26,6 @@ configure.tps configure.vr configure.vrs dir.info -Makefile lost+found update.out LAST_UPDATED diff --git a/ChangeLog b/ChangeLog index a4c8a7de662..031c6a6355b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-06-18 Phil Edwards + + * 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 * MAINTAINERS (Write After Approval): Add self. diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..ff81fa5af29 --- /dev/null +++ b/Makefile @@ -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}) + diff --git a/configure b/configure index d64ea3337b7..3e891d93646 100755 --- a/configure +++ b/configure @@ -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