2019-08-09 07:56:16 -04:00
|
|
|
#!/bin/sh
|
|
|
|
set -eu
|
2019-08-09 12:50:21 -04:00
|
|
|
CFLAGS="-Wall -Wextra -Wno-strict-aliasing -std=gnu99"
|
2019-08-09 16:12:19 -04:00
|
|
|
CFLAGS="$CFLAGS -O2" # -falign-functions
|
2019-08-09 10:18:36 -04:00
|
|
|
CFLAGS="$CFLAGS -I ../c -D NDEBUG -D USE_COMPUTED_GOTO"
|
2019-08-09 07:56:16 -04:00
|
|
|
LFLAGS="-lm"
|
2019-08-09 16:12:19 -04:00
|
|
|
os="$(uname | tr A-Z- a-z_)"
|
2019-08-09 18:43:47 -04:00
|
|
|
case "$os" in
|
|
|
|
darwin)
|
|
|
|
default_cc="clang"
|
|
|
|
;;
|
|
|
|
dragonfly)
|
|
|
|
default_cc="gcc"
|
|
|
|
;;
|
|
|
|
freebsd)
|
|
|
|
default_cc="clang"
|
|
|
|
;;
|
|
|
|
haiku)
|
|
|
|
default_cc="gcc"
|
|
|
|
;;
|
|
|
|
linux)
|
|
|
|
default_cc="gcc"
|
2019-08-09 18:50:04 -04:00
|
|
|
CFLAGS="$CFLAGS -D _GNU_SOURCE"
|
2019-08-09 18:43:47 -04:00
|
|
|
;;
|
|
|
|
netbsd)
|
|
|
|
default_cc="gcc"
|
|
|
|
;;
|
|
|
|
openbsd)
|
|
|
|
default_cc="clang"
|
|
|
|
;;
|
|
|
|
sunos)
|
|
|
|
default_cc="gcc"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown operating system: $os" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
CC="${CC:-$default_cc}"
|
2019-08-09 16:12:19 -04:00
|
|
|
builddir="build-$os-$(uname -m | tr A-Z- a-z_)"
|
2019-08-09 07:56:16 -04:00
|
|
|
cd "$(dirname "$0")"/..
|
|
|
|
echo "Entering directory '$PWD'"
|
|
|
|
set -x
|
|
|
|
mkdir -p "$builddir"
|
|
|
|
find "$builddir" -mindepth 1 -delete
|
|
|
|
{ set +x; } 2>/dev/null
|
|
|
|
cd "$builddir"
|
|
|
|
echo "Entering directory '$PWD'"
|
|
|
|
set -x
|
2019-08-09 16:12:19 -04:00
|
|
|
ln -s ../scheme-boot/flisp.boot flisp.boot
|
2019-08-09 08:02:58 -04:00
|
|
|
$CC $CFLAGS -c ../c/bitvector-ops.c
|
|
|
|
$CC $CFLAGS -c ../c/bitvector.c
|
2019-08-09 10:30:49 -04:00
|
|
|
$CC $CFLAGS -c ../c/builtins.c
|
2019-08-09 08:02:58 -04:00
|
|
|
$CC $CFLAGS -c ../c/dump.c
|
2019-08-09 17:35:16 -04:00
|
|
|
$CC $CFLAGS -c ../c/env_unix.c
|
2019-08-09 10:30:49 -04:00
|
|
|
$CC $CFLAGS -c ../c/equalhash.c
|
|
|
|
$CC $CFLAGS -c ../c/flisp.c
|
|
|
|
$CC $CFLAGS -c ../c/flmain.c
|
2019-08-09 16:12:19 -04:00
|
|
|
$CC $CFLAGS -c ../c/fs_"$os".c
|
|
|
|
$CC $CFLAGS -c ../c/fs_unix.c
|
2019-08-09 08:02:58 -04:00
|
|
|
$CC $CFLAGS -c ../c/hashing.c
|
|
|
|
$CC $CFLAGS -c ../c/htable.c
|
|
|
|
$CC $CFLAGS -c ../c/int2str.c
|
|
|
|
$CC $CFLAGS -c ../c/ios.c
|
2019-08-09 10:30:49 -04:00
|
|
|
$CC $CFLAGS -c ../c/iostream.c
|
2019-08-09 08:02:58 -04:00
|
|
|
$CC $CFLAGS -c ../c/lltinit.c
|
|
|
|
$CC $CFLAGS -c ../c/ptrhash.c
|
|
|
|
$CC $CFLAGS -c ../c/random.c
|
|
|
|
$CC $CFLAGS -c ../c/socket.c
|
2019-08-09 10:30:49 -04:00
|
|
|
$CC $CFLAGS -c ../c/string.c
|
|
|
|
$CC $CFLAGS -c ../c/table.c
|
2019-08-09 16:56:18 -04:00
|
|
|
$CC $CFLAGS -c ../c/time_unix.c
|
2019-08-09 08:02:58 -04:00
|
|
|
$CC $CFLAGS -c ../c/utf8.c
|
2019-08-09 07:56:16 -04:00
|
|
|
$CC $LFLAGS -o flisp -lm \
|
2019-08-09 18:43:47 -04:00
|
|
|
bitvector-ops.o bitvector.o builtins.o dump.o env_unix.o \
|
|
|
|
equalhash.o flisp.o flmain.o fs_"$os".o fs_unix.o \
|
|
|
|
hashing.o htable.o int2str.o \
|
|
|
|
ios.o iostream.o lltinit.o ptrhash.o random.o socket.o \
|
|
|
|
string.o table.o time_unix.o utf8.o
|
2019-08-09 07:56:16 -04:00
|
|
|
{ set +x; } 2>/dev/null
|
2019-08-09 08:21:56 -04:00
|
|
|
cd ../scheme-core
|
2019-08-09 07:56:16 -04:00
|
|
|
echo "Entering directory '$PWD'"
|
|
|
|
echo "Creating stage 0 boot file..."
|
|
|
|
set -x
|
2019-08-09 08:21:56 -04:00
|
|
|
../"$builddir"/flisp mkboot0.scm system.scm compiler.scm >flisp.boot.new
|
2019-08-09 08:53:31 -04:00
|
|
|
mv flisp.boot.new ../scheme-boot/flisp.boot
|
2019-08-09 07:56:16 -04:00
|
|
|
{ set +x; } 2>/dev/null
|
|
|
|
echo "Creating stage 1 boot file..."
|
|
|
|
set -x
|
2019-08-09 08:21:56 -04:00
|
|
|
../"$builddir"/flisp mkboot1.scm
|
2019-08-09 08:53:31 -04:00
|
|
|
mv flisp.boot.new ../scheme-boot/flisp.boot
|
2019-08-09 07:56:16 -04:00
|
|
|
{ set +x; } 2>/dev/null
|
2019-08-09 08:21:56 -04:00
|
|
|
cd ../scheme-tests
|
2019-08-09 07:56:16 -04:00
|
|
|
echo "Entering directory '$PWD'"
|
2019-08-09 08:21:56 -04:00
|
|
|
../"$builddir"/flisp unittest.scm
|