2019-07-07 10:17:03 +00:00
|
|
|
#! @SHELL@
|
|
|
|
|
|
|
|
# GNU Mes --- Maxwell Equations of Software
|
2020-12-15 17:06:40 +00:00
|
|
|
# Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2019-07-07 10:17:03 +00:00
|
|
|
#
|
|
|
|
# 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/>.
|
|
|
|
|
2020-12-15 17:06:40 +00:00
|
|
|
if test "$V" = 1 -o "$V" = 2; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
2019-07-07 10:17:03 +00:00
|
|
|
LANG=
|
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
|
|
|
|
MES_PREFIX=${MES_PREFIX-$PWD}
|
2019-07-07 10:17:03 +00:00
|
|
|
|
2019-12-05 07:30:30 +00:00
|
|
|
. ./config.sh
|
|
|
|
. ${srcdest}build-aux/configure-lib.sh
|
|
|
|
. ${srcdest}build-aux/cflags.sh
|
2019-07-07 10:17:03 +00:00
|
|
|
|
2020-10-18 21:15:11 +00:00
|
|
|
if test -n "@M2_PLANET@"; then
|
|
|
|
echo " KAEM kaem.run"
|
|
|
|
kaem --strict --verbose
|
|
|
|
fi
|
|
|
|
|
2019-07-07 10:17:03 +00:00
|
|
|
CPPFLAGS="-D HAVE_CONFIG_H=1 -I include"
|
2020-12-15 17:06:40 +00:00
|
|
|
libdir=$PWD/lib
|
|
|
|
export libdir
|
2019-07-07 10:17:03 +00:00
|
|
|
mkdir -p mescc-lib
|
|
|
|
cp config.sh mescc-lib/config.sh
|
|
|
|
cd mescc-lib
|
2019-12-05 07:30:30 +00:00
|
|
|
srcdest=../${srcdest}
|
|
|
|
ln -sf ${srcdest}mes .
|
|
|
|
ln -sf ${srcdest}module .
|
|
|
|
ln -sf ${srcdest}src .
|
lib: stat: Use SYS_stat64 for 32bit platforms.
This fixes <https://debbugs.gnu.org/41264>.
* include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/sys/stat.h (struct stat): Move definition to...
* include/linux/arm/kernel-stat.h,
include/linux/m2/kernel-stat.h,
include/linux/x86/kernel-stat.h,
include/linux/x86_64/kernel-stat.h: These new files.
* include/gnu/x86/kernel-stat.h: New file.
* configure (main): Copy <srcdest>include/<kernel>/<arch>/*.h to
include/.
* configure.sh: Likewise.
* .gitignore: Ignore them. Add copyright header.
* build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New
variables.
(build): Use them.
(include/arch/%.h, arch-dir): New targets.
* build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace
<srcdest>include/<kernel>/<cpu> with built ../include.
* build-aux/build.sh.in (AM_CPPFLAGS): Likewise.
* build-aux/install.sh.in: Also install built include.
* include/m2/types.h: New file.
* kaem.run: Use it.
* simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to
include/arch.
2022-10-29 11:17:58 +00:00
|
|
|
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
|
2020-12-15 17:06:40 +00:00
|
|
|
AM_CFLAGS="-L ${srcdest}lib"
|
2019-07-07 10:17:03 +00:00
|
|
|
|
2019-12-05 07:30:30 +00:00
|
|
|
mkdir -p $mes_cpu-mes
|
2019-12-05 07:51:27 +00:00
|
|
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
|
2019-07-07 10:17:03 +00:00
|
|
|
cp crt1.o $mes_cpu-mes
|
|
|
|
cp crt1.s $mes_cpu-mes
|
|
|
|
|
|
|
|
objects=
|
|
|
|
for c in $libc_mini_SOURCES; do
|
|
|
|
o=$(basename $c .c).o
|
2019-12-11 13:04:27 +00:00
|
|
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
2019-12-07 22:29:34 +00:00
|
|
|
echo " CC $c"
|
|
|
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
|
|
|
fi
|
2019-07-07 10:17:03 +00:00
|
|
|
objects="$objects $o"
|
|
|
|
done
|
2019-12-07 22:29:34 +00:00
|
|
|
echo " AR $mes_cpu-mes/libc-mini.a"
|
2019-07-07 10:17:03 +00:00
|
|
|
$AR crD $mes_cpu-mes/libc-mini.a $objects
|
|
|
|
|
2020-12-15 17:06:40 +00:00
|
|
|
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
|
|
|
|
|
2019-07-07 10:17:03 +00:00
|
|
|
objects=
|
|
|
|
for c in $libc_SOURCES; do
|
|
|
|
o=$(basename $c .c).o
|
2019-12-11 13:04:27 +00:00
|
|
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
2019-12-07 22:29:34 +00:00
|
|
|
echo " CC $c"
|
|
|
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
|
|
|
fi
|
2019-07-07 10:17:03 +00:00
|
|
|
objects="$objects $o"
|
|
|
|
done
|
2019-12-07 22:29:34 +00:00
|
|
|
echo " AR $mes_cpu-mes/libc.a"
|
2019-07-07 10:17:03 +00:00
|
|
|
$AR crD $mes_cpu-mes/libc.a $objects
|
|
|
|
|
|
|
|
objects=
|
|
|
|
for c in $libc_tcc_SOURCES; do
|
|
|
|
o=$(basename $c .c).o
|
2019-12-11 13:04:27 +00:00
|
|
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
2019-12-07 22:29:34 +00:00
|
|
|
echo " CC $c"
|
|
|
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
|
|
|
fi
|
2019-07-07 10:17:03 +00:00
|
|
|
objects="$objects $o"
|
|
|
|
done
|
2019-12-07 22:29:34 +00:00
|
|
|
echo " AR $mes_cpu-mes/libc+tcc.a"
|
2019-07-07 10:17:03 +00:00
|
|
|
$AR crD $mes_cpu-mes/libc+tcc.a $objects
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
srcdest=
|
lib: stat: Use SYS_stat64 for 32bit platforms.
This fixes <https://debbugs.gnu.org/41264>.
* include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/sys/stat.h (struct stat): Move definition to...
* include/linux/arm/kernel-stat.h,
include/linux/m2/kernel-stat.h,
include/linux/x86/kernel-stat.h,
include/linux/x86_64/kernel-stat.h: These new files.
* include/gnu/x86/kernel-stat.h: New file.
* configure (main): Copy <srcdest>include/<kernel>/<arch>/*.h to
include/.
* configure.sh: Likewise.
* .gitignore: Ignore them. Add copyright header.
* build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New
variables.
(build): Use them.
(include/arch/%.h, arch-dir): New targets.
* build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace
<srcdest>include/<kernel>/<cpu> with built ../include.
* build-aux/build.sh.in (AM_CPPFLAGS): Likewise.
* build-aux/install.sh.in: Also install built include.
* include/m2/types.h: New file.
* kaem.run: Use it.
* simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to
include/arch.
2022-10-29 11:17:58 +00:00
|
|
|
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
|
2020-12-15 17:06:40 +00:00
|
|
|
AM_CFLAGS="-L ${srcdest}lib"
|
2019-07-07 10:17:03 +00:00
|
|
|
|
|
|
|
objects=
|
|
|
|
for c in $mes_SOURCES; do
|
|
|
|
o=$(basename $c .c).o
|
2019-12-11 13:04:27 +00:00
|
|
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
2019-12-07 22:29:34 +00:00
|
|
|
echo " CC $c"
|
|
|
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
|
|
|
fi
|
2019-07-07 10:17:03 +00:00
|
|
|
objects="$objects $o"
|
|
|
|
done
|
2019-11-03 21:15:11 +00:00
|
|
|
echo " CCLD bin/mes-mescc"
|
|
|
|
mkdir -p bin
|
2020-12-15 17:06:40 +00:00
|
|
|
$CC $AM_CFLAGS -nostdlib -o bin/mes-mescc -L mescc-lib mescc-lib/crt1.o $objects -lc -lmescc
|
2019-11-03 21:15:11 +00:00
|
|
|
cp bin/mes-mescc bin/mes
|
2019-09-20 17:40:37 +00:00
|
|
|
|
|
|
|
(
|
|
|
|
mkdir -p gcc-lib
|
|
|
|
cp config.sh gcc-lib
|
|
|
|
cd gcc-lib
|
|
|
|
compiler=gcc
|
|
|
|
if test -z "$srcdest"; then
|
|
|
|
srcdest=../
|
|
|
|
srcdir=../
|
|
|
|
fi
|
|
|
|
@SHELL@ ${srcdest}build-aux/build-source-lib.sh
|
|
|
|
)
|