2018-04-29 16:38:57 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2018-07-22 12:24:36 +00:00
|
|
|
# GNU Mes --- Maxwell Equations of Software
|
2021-05-01 13:40:56 +00:00
|
|
|
# Copyright © 2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2018-04-29 16:38:57 +00:00
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
# This file is part of GNU Mes.
|
2018-04-29 16:38:57 +00:00
|
|
|
#
|
2018-07-22 12:24:36 +00:00
|
|
|
# GNU Mes is free software; you can redistribute it and/or modify it
|
2018-04-29 16:38:57 +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-04-29 16:38:57 +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-04-29 16:38:57 +00:00
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
set -e
|
2019-06-08 13:36:22 +00:00
|
|
|
set -u
|
2018-11-06 19:29:35 +00:00
|
|
|
|
2019-12-05 09:02:14 +00:00
|
|
|
V=${V-}
|
2019-06-08 13:36:22 +00:00
|
|
|
|
|
|
|
if [ "$V" = 2 ]; then
|
|
|
|
set -x
|
2018-11-06 19:29:35 +00:00
|
|
|
fi
|
|
|
|
|
2019-06-08 13:36:22 +00:00
|
|
|
. ./config.sh
|
2018-07-25 06:14:13 +00:00
|
|
|
. ${srcdest}build-aux/trace.sh
|
2018-11-06 19:29:35 +00:00
|
|
|
. ${srcdest}build-aux/cc.sh
|
2020-04-19 08:49:48 +00:00
|
|
|
. ${srcdest}build-aux/configure-lib.sh
|
2018-05-03 18:32:06 +00:00
|
|
|
|
2019-06-08 13:36:22 +00:00
|
|
|
trap 'test -f .log && cat .log' EXIT
|
|
|
|
|
2020-04-19 08:49:48 +00:00
|
|
|
for c in $mes_SOURCES; do
|
2019-06-08 13:36:22 +00:00
|
|
|
compile $c
|
|
|
|
done
|
|
|
|
if test $mes_libc = system; then
|
|
|
|
LIBS=-lmes
|
|
|
|
fi
|
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
|
|
|
if [ "$compiler" = "gcc" ]
|
|
|
|
then
|
2020-08-29 10:50:34 +00:00
|
|
|
# Make it possible to resolve raise(), required by libgcc.a, provided in
|
|
|
|
# libc.a. The final command line has to have "-lc -lgcc -lc".
|
|
|
|
# See <https://www.openwall.com/lists/musl/2018/05/09/1>.
|
|
|
|
LIBS="${LIBS} -lgcc -lc"
|
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
|
|
|
fi
|
2021-05-01 13:40:56 +00:00
|
|
|
if [ "$compiler" = "mescc" ]; then
|
|
|
|
LIBS="${LIBS} -lc -lmescc"
|
|
|
|
fi
|
2019-11-03 21:15:11 +00:00
|
|
|
link bin/mes-$compiler
|
|
|
|
cp bin/mes-$compiler bin/mes
|