bootstrap: Resurrect.

* build-aux/bootstrap.sh.in (AM_CFLAGS): Use -L ${srcdest}lib.
Build libmescc.a and use it to link mes.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-12-15 18:06:40 +01:00
parent 8b2c4d48a9
commit 3aecca4bdc
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -1,7 +1,7 @@
#! @SHELL@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -18,6 +18,10 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
if test "$V" = 1 -o "$V" = 2; then
set -x
fi
LANG=
MES_ARENA=${MES_ARENA-20000000}
export MES_ARENA
@ -32,7 +36,8 @@ MES_PREFIX=${MES_PREFIX-$PWD}
. ${srcdest}build-aux/cflags.sh
CPPFLAGS="-D HAVE_CONFIG_H=1 -I include"
AM_CFLAGS=""
libdir=$PWD/lib
export libdir
mkdir -p mescc-lib
cp config.sh mescc-lib/config.sh
cd mescc-lib
@ -41,6 +46,7 @@ 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"
AM_CFLAGS="-L ${srcdest}lib"
mkdir -p $mes_cpu-mes
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
@ -59,6 +65,18 @@ done
echo " AR $mes_cpu-mes/libc-mini.a"
$AR crD $mes_cpu-mes/libc-mini.a $objects
objects=
for c in $libmescc_SOURCES; do
o=$(basename $c .c).o
if test ! -e $o -o ${srcdest}$c -nt $o; then
echo " CC $c"
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
fi
objects="$objects $o"
done
echo " AR $mes_cpu-mes/libmescc.a"
$AR crD $mes_cpu-mes/libmescc.a $objects
objects=
for c in $libc_SOURCES; do
o=$(basename $c .c).o
@ -86,6 +104,7 @@ $AR crD $mes_cpu-mes/libc+tcc.a $objects
cd ..
srcdest=
CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
AM_CFLAGS="-L ${srcdest}lib"
objects=
for c in $mes_SOURCES; do
@ -98,7 +117,7 @@ for c in $mes_SOURCES; do
done
echo " CCLD bin/mes-mescc"
mkdir -p bin
$CC -nostdlib -o bin/mes-mescc -L mescc-lib mescc-lib/crt1.o $objects -lc
$CC $AM_CFLAGS -nostdlib -o bin/mes-mescc -L mescc-lib mescc-lib/crt1.o $objects -lc -lmescc
cp bin/mes-mescc bin/mes
(