2017-11-24 18:02:58 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2018-07-22 12:24:36 +00:00
|
|
|
# GNU Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2018-01-01 14:53:13 +00:00
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
# This file is part of GNU Mes.
|
2018-01-01 14:53:13 +00:00
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
# GNU Mes is free software; you can redistribute it and/or modify it
|
2018-01-01 14:53:13 +00:00
|
|
|
# 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.
|
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
# GNU Mes is distributed in the hope that it will be useful, but
|
2018-01-01 14:53:13 +00:00
|
|
|
# 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
|
2018-07-22 12:24:36 +00:00
|
|
|
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2018-01-01 14:53:13 +00:00
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
set -e
|
|
|
|
|
2019-09-06 21:24:23 +00:00
|
|
|
MES_ARENA=${MES_ARENA-20000000}
|
|
|
|
export MES_ARENA
|
|
|
|
MES_MAX_ARENA=${MES_MAX_ARENA-${MES_ARENA}}
|
|
|
|
export MES_MAX_ARENA
|
|
|
|
MES_STACK=${MES_STACK-5000000}
|
|
|
|
export MES_STACK
|
|
|
|
|
2019-06-08 13:36:22 +00:00
|
|
|
. ./config.sh
|
2018-05-25 06:05:02 +00:00
|
|
|
|
2019-06-08 13:36:22 +00:00
|
|
|
if $courageous; then
|
|
|
|
echo "Applying courage"
|
|
|
|
set +e
|
|
|
|
fi
|
|
|
|
|
|
|
|
CFLAGS=
|
2020-06-01 22:03:03 +00:00
|
|
|
if test $mes_cpu = arm; then
|
|
|
|
CFLAGS="-marm"
|
|
|
|
fi
|
2019-06-08 13:36:22 +00:00
|
|
|
if test $mes_libc = mes; then
|
2019-07-03 14:47:42 +00:00
|
|
|
CFLAGS="${CFLAGS}
|
2019-07-06 11:57:30 +00:00
|
|
|
-static
|
2019-06-08 13:36:22 +00:00
|
|
|
-nostdinc
|
|
|
|
-nostdlib
|
|
|
|
-fno-builtin
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
|
|
|
|
CPPFLAGS="
|
|
|
|
-D HAVE_CONFIG_H=1
|
|
|
|
-I ../include
|
|
|
|
-I ${srcdir}/include
|
|
|
|
-I ${srcdir}/include/$mes_kernel/$mes_cpu
|
|
|
|
"
|
|
|
|
|
|
|
|
LIBS=
|
|
|
|
LDFLAGS=
|
|
|
|
if test $mes_libc = mes; then
|
|
|
|
LDFLAGS="
|
|
|
|
-nostdlib
|
|
|
|
"
|
|
|
|
LIBS=-lc
|
|
|
|
fi
|
|
|
|
|
|
|
|
export CFLAGS
|
|
|
|
export CPPFLAGS
|
|
|
|
export LDFLAGS
|
|
|
|
#export LIBS
|
|
|
|
|
2019-06-10 09:39:31 +00:00
|
|
|
recheck=${recheck-false}
|
|
|
|
export recheck
|
|
|
|
|
2019-06-25 19:40:43 +00:00
|
|
|
./pre-inst-env ${SHELL} ${srcdest}build-aux/check-boot.sh
|
|
|
|
./pre-inst-env ${SHELL} ${srcdest}build-aux/check-mes.sh
|
2019-06-08 13:36:22 +00:00
|
|
|
|
|
|
|
if test $compiler = gcc; then
|
|
|
|
(
|
|
|
|
cd gcc-lib
|
|
|
|
srcdest=$srcdir/../
|
|
|
|
srcdir=../$srcdir
|
2019-06-25 19:40:43 +00:00
|
|
|
../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh
|
2019-06-08 13:36:22 +00:00
|
|
|
)
|
2018-08-09 08:22:26 +00:00
|
|
|
fi
|
2019-06-08 13:36:22 +00:00
|
|
|
|
|
|
|
(
|
|
|
|
cd mescc-lib
|
|
|
|
srcdest=$srcdir/../
|
|
|
|
srcdir=../$srcdir
|
|
|
|
compiler=mescc
|
|
|
|
mes_lib=mes
|
|
|
|
CFLAGS="
|
|
|
|
-nostdinc
|
|
|
|
-nostdlib
|
|
|
|
-fno-builtin
|
|
|
|
"
|
|
|
|
LDFLAGS="
|
|
|
|
-nostdlib
|
|
|
|
"
|
Introduce libmescc.a; Put division by integer in there; split syscalls' errno off.
* build-aux/configure-lib.sh (libmescc_SOURCES): Add lib/mes/div.c,
lib/linux/*/syscall-internal.c.
* build-aux/build-lib.sh: Add libmescc.a.
* build-aux/build-mes.sh: On gcc, add "-lmescc".
* build-aux/test-c.sh: Add "-lmescc".
* build-aux/check.sh.in: Add mescc to LIBS.
* module/mescc/mescc.scm (mescc:link): Add "mescc".
* module/mescc.scm (mescc:main): Update documentation of "-nodefaultlibs"
and "-nostdlib".
* lib/mes/div.c (ldiv): Rename to...
(__mesabi_ldiv): ...this. Avoid assert.
(__mesabi_div0): Avoid assert.
(__aeabi_idivmod): New procedure.
(__aeabi_idiv): New procedure.
(__aeabi_uidivmod): New procedure.
(__aeabi_uidiv): New procedure.
* lib/linux/x86-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4): Move to...
* lib/linux/x86-mes-gcc/syscall-internal.c: ...here.
(__raise): New procedure.
* lib/linux/x86-mes-mescc/syscall.c (__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4): Move to...
* lib/linux/x86-mes-mescc/syscall-internal.c: ...here.
(__raise): New procedure.
* lib/linux/arm-mes-gcc/syscall.c: New file.
* lib/linux/arm-mes-gcc/syscall-internal.c: New file.
* lib/linux/arm-mes-mescc/syscall.c: New file.
* lib/linux/arm-mes-mescc/syscall-internal.c: New file.
* lib/gnu/syscall.c (__syscall, __syscall2, __syscall_get, __syscall_put):
Move to...
* lib/gnu/syscall-internal.c: ...here.
2020-06-01 21:47:49 +00:00
|
|
|
LIBS="-lc -lmescc"
|
2019-07-21 14:44:54 +00:00
|
|
|
AR="${srcdest}pre-inst-env mesar"
|
2019-06-08 13:36:22 +00:00
|
|
|
CC="${srcdest}pre-inst-env mescc"
|
2019-06-25 19:40:43 +00:00
|
|
|
../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh
|
2019-06-08 13:36:22 +00:00
|
|
|
)
|