bootstrap: Support srcdir builds.

* build-aux/bootstrap.sh.in (srcdest): Initialize.
* build-aux/build-lib.sh: Source config.sh.
* configure.sh: Support srcdir builds.
* build-aux/build.sh.in: Move setting of cflags to ...
* build-aux/cflags.sh: ... New file.
This commit is contained in:
Jan Nieuwenhuizen 2019-12-05 08:30:30 +01:00
parent 6b0ff3f322
commit 066143d820
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
5 changed files with 65 additions and 39 deletions

View File

@ -27,17 +27,22 @@ MES_STACK=${MES_STACK-5000000}
export MES_STACK
MES_PREFIX=${MES_PREFIX-$PWD}
. build-aux/configure-lib.sh
. ./config.sh
. ${srcdest}build-aux/configure-lib.sh
. ${srcdest}build-aux/cflags.sh
CPPFLAGS="-D HAVE_CONFIG_H=1 -I include"
AM_CFLAGS=""
mkdir -p mescc-lib
cp config.sh mescc-lib/config.sh
cd mescc-lib
srcdest=../
srcdest=../${srcdest}
ln -sf ${srcdest}mes .
ln -sf ${srcdest}module .
ln -sf ${srcdest}src .
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
mkdir $mes_cpu-mes
mkdir -p $mes_cpu-mes
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
cp crt1.o $mes_cpu-mes
cp crt1.s $mes_cpu-mes

View File

@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
srcdest=${srcdest-}
. ./config.sh
. ${srcdest}build-aux/configure-lib.sh
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/cc.sh

View File

@ -36,6 +36,7 @@ fi
set -u
. ./config.sh
. ${srcdest}build-aux/cflags.sh
if $courageous; then
echo "Applying courage"
@ -48,41 +49,6 @@ if test -n "$GUILE" -a "$GUILE" != true; then
${SHELL} ${srcdest}build-aux/build-guile.sh
fi
AM_CFLAGS=
if test $mes_libc = mes; then
AM_CFLAGS="
-static
"
AM_CFLAGS="$AM_CFLAGS
-nostdinc
-nostdlib
-fno-builtin
"
fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ../include
-I ${srcdir}/../include
-I ${srcdir}/../include/$mes_kernel/$mes_cpu
"
AM_LDFLAGS="
-L .
"
if test $mes_libc = mes; then
AM_LDFLAGS="$AM_LDFLAGS
-nostdlib
"
fi
LIBS=-lc
export AM_CFLAGS CFLAGS
export AM_CPPFLAGS CPPFLAGS
export AM_LDFLAGS LDFLAGS
export LIBS
(
mkdir -p gcc-lib
cp config.sh gcc-lib

50
build-aux/cflags.sh Normal file
View File

@ -0,0 +1,50 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes 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 3 of the License, or (at
# your option) any later version.
#
# GNU Mes 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 GNU Mes. If not, see <http://www.gnu.org/licenses/>.
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
AM_CFLAGS=
if test $mes_libc = mes; then
AM_CFLAGS="$AM_CFLAGS
-static
-nostdinc
-nostdlib
-fno-builtin
"
fi
AM_LDFLAGS="
-L .
"
if test $mes_libc = mes; then
AM_LDFLAGS="$AM_LDFLAGS
-static
-nostdlib
"
fi
LIBS=-lc
export AM_CFLAGS CFLAGS
export AM_CPPFLAGS CPPFLAGS
export AM_LDFLAGS LDFLAGS
export LIBS

View File

@ -22,6 +22,10 @@ set -e
VERSION=0.21
srcdir=${srcdir-$(dirname $0)}
srcdest=
if test "$srcdir" != "."; then
srcdest=$srcdir/
fi
. ${srcdest}build-aux/trace.sh
# parse arguments
@ -210,6 +214,7 @@ fi
mes_system=$mes_cpu-$mes_kernel-mes
mkdir -p scripts
subst ${srcdest}build-aux/GNUmakefile.in GNUmakefile
subst ${srcdest}build-aux/config.sh.in config.sh
subst ${srcdest}build-aux/bootstrap.sh.in bootstrap.sh