2018-04-29 16:38:57 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
# Mes --- Maxwell Equations of Software
|
|
|
|
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
|
|
|
#
|
|
|
|
# This file is part of Mes.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# 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 Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-05-03 18:32:06 +00:00
|
|
|
set -x
|
2018-04-29 16:38:57 +00:00
|
|
|
|
2018-05-03 18:32:06 +00:00
|
|
|
export BLOOD_ELF GUILE HEX2 M1 MES MESCC
|
|
|
|
export M1FLAGS HEX2FLAGS PREPROCESS
|
|
|
|
export MES_SEED MES_ARENA
|
|
|
|
|
|
|
|
HEX2=${HEX2-hex2}
|
|
|
|
M1=${M1-M1}
|
|
|
|
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
|
|
|
MES_SEED=${MES_SEED-../mes-seed}
|
|
|
|
MESCC=${MESCC-$(command -v mescc)}
|
2018-04-29 16:38:57 +00:00
|
|
|
[ -z "$MESCC" ] && MESCC=scripts/mescc
|
2018-05-03 18:32:06 +00:00
|
|
|
MES=${MES-$(command -v mes)}
|
2018-04-29 16:38:57 +00:00
|
|
|
[ -z "$MES" ] && MES=src/mes
|
|
|
|
|
|
|
|
CPPFLAGS=${CPPFLAGS-"
|
|
|
|
-D VERSION=\"$VERSION\"
|
|
|
|
-D MODULEDIR=\"$MODULEDIR\"
|
|
|
|
-D PREFIX=\"$PREFIX\"
|
|
|
|
-I src
|
|
|
|
-I lib
|
|
|
|
-I include
|
|
|
|
"}
|
|
|
|
|
|
|
|
MESCCLAGS=${MESCCFLAGS-"
|
|
|
|
"}
|
2018-05-01 14:50:29 +00:00
|
|
|
LIBC=${LIBC-lib/libc}
|
2018-05-03 18:32:06 +00:00
|
|
|
M1FLAGS=${M1FLAGS-"
|
|
|
|
--LittleEndian
|
|
|
|
--Architecture=1
|
|
|
|
"}
|
|
|
|
HEX2FLAGS=${HEX2FLAGS-"
|
|
|
|
--LittleEndian
|
|
|
|
--Architecture=1
|
|
|
|
--BaseAddress=0x1000000
|
|
|
|
"}
|
2018-04-29 16:38:57 +00:00
|
|
|
|
|
|
|
c=$1
|
|
|
|
|
2018-05-03 18:32:06 +00:00
|
|
|
set -e
|
|
|
|
|
2018-04-29 16:38:57 +00:00
|
|
|
if [ -n "$PREPROCESS" ]; then
|
|
|
|
sh -x $MESCC\
|
|
|
|
-E\
|
|
|
|
$CPPFLAGS\
|
|
|
|
$MESCCFLAGS\
|
|
|
|
-o "$c".E\
|
|
|
|
"$c".c
|
|
|
|
sh -x $MESCC\
|
|
|
|
-c\
|
|
|
|
-o "$c".M1\
|
|
|
|
"$c".E
|
|
|
|
else
|
|
|
|
sh -x $MESCC\
|
|
|
|
-c\
|
|
|
|
$CPPFLAGS\
|
|
|
|
$MESCCFLAGS\
|
|
|
|
-o "$c".M1\
|
|
|
|
"$c".c
|
|
|
|
fi
|
|
|
|
|
2018-05-03 18:32:06 +00:00
|
|
|
$M1\
|
|
|
|
$M1FLAGS\
|
2018-04-29 16:38:57 +00:00
|
|
|
-f stage0/x86.M1\
|
|
|
|
-f "$c".M1\
|
|
|
|
-o "$c".hex2
|
|
|
|
|
|
|
|
if [ -z "$NOLINK" ]; then
|
|
|
|
$BLOOD_ELF\
|
|
|
|
-f stage0/x86.M1\
|
|
|
|
-f "$c".M1\
|
2018-05-01 14:50:29 +00:00
|
|
|
-f $LIBC-mes.M1\
|
2018-04-29 16:38:57 +00:00
|
|
|
-o "$c".blood-elf-M1
|
2018-05-03 18:32:06 +00:00
|
|
|
$M1\
|
|
|
|
$M1FLAGS\
|
2018-04-29 16:38:57 +00:00
|
|
|
-f "$c".blood-elf-M1\
|
|
|
|
-o "$c".blood-elf-hex2
|
2018-05-03 18:32:06 +00:00
|
|
|
$HEX2\
|
|
|
|
$HEX2FLAGS\
|
|
|
|
-f stage0/elf32-header.hex2\
|
|
|
|
-f lib/crt1.hex2\
|
|
|
|
-f $LIBC-mes.hex2\
|
|
|
|
-f "$c".hex2\
|
|
|
|
-f "$c".blood-elf-hex2\
|
|
|
|
--exec_enable\
|
|
|
|
-o "$c".mes-out
|
2018-04-29 16:38:57 +00:00
|
|
|
fi
|