2018-07-21 22:43:39 +00:00
|
|
|
# GNU Mes --- Maxwell Equations of Software
|
|
|
|
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
|
|
|
#
|
|
|
|
# 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/>.
|
|
|
|
|
2018-08-23 17:57:50 +00:00
|
|
|
srcdir=${srcdir-.}
|
2018-09-09 05:11:50 +00:00
|
|
|
top_builddir=${top_builddir-.}
|
2018-11-06 19:29:35 +00:00
|
|
|
|
2018-07-21 22:43:39 +00:00
|
|
|
if [ "$V" = 2 ]; then
|
|
|
|
echo $0
|
2018-07-25 06:14:13 +00:00
|
|
|
echo srcdest=${srcdest}
|
2018-07-21 22:43:39 +00:00
|
|
|
echo top_builddir=${top_builddir}
|
|
|
|
fi
|
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
if [ -n "$mes_p" -a -n "$gcc_p" ]; then
|
|
|
|
crt1=lib/linux/$mes_arch/crt1.o
|
|
|
|
fi
|
|
|
|
|
|
|
|
MES=${MES-${program_prefix}mes}
|
|
|
|
libc=${libc-"-l c"}
|
|
|
|
export libc
|
|
|
|
|
|
|
|
if [ ! "$CC" ]; then
|
|
|
|
CC="./pre-inst-env mescc"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export AR
|
2018-07-21 22:43:39 +00:00
|
|
|
export CC
|
|
|
|
export CFLAGS
|
|
|
|
export CPPFLAGS
|
2018-11-06 19:29:35 +00:00
|
|
|
export GUILD
|
2018-07-21 22:43:39 +00:00
|
|
|
export GUILE
|
2018-08-15 17:11:54 +00:00
|
|
|
export GUILE_LOAD_COMPILED_PATH
|
|
|
|
export GUILE_LOAD_PATH
|
2018-07-21 22:43:39 +00:00
|
|
|
export HEX2
|
|
|
|
export HEX2FLAGS
|
|
|
|
export M1
|
|
|
|
export M1FLAGS
|
|
|
|
export MES
|
|
|
|
export MES_CFLAGS
|
2018-11-06 19:29:35 +00:00
|
|
|
export MES_FOR_BUILD
|
|
|
|
export MES_SEED
|
|
|
|
export MESCC
|
2018-07-21 22:43:39 +00:00
|
|
|
|
|
|
|
export MES_DEBUG
|
|
|
|
export MES_ARENA
|
2018-07-26 17:36:03 +00:00
|
|
|
export TINYCC_PREFIX
|
2018-07-21 22:43:39 +00:00
|
|
|
export V
|
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
export config_status
|
2018-07-21 22:43:39 +00:00
|
|
|
export abs_top_builddir
|
|
|
|
export abs_top_srcdir
|
2018-10-09 17:22:51 +00:00
|
|
|
export arch
|
2018-07-21 22:43:39 +00:00
|
|
|
export datadir
|
|
|
|
export moduledir
|
|
|
|
export prefix
|
2018-11-06 19:29:35 +00:00
|
|
|
export program_prefix
|
2018-07-25 06:14:13 +00:00
|
|
|
export srcdest
|
2018-07-21 22:43:39 +00:00
|
|
|
export srcdir
|
|
|
|
export top_builddir
|
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
export bits
|
|
|
|
export build
|
|
|
|
export host
|
|
|
|
export compiler
|
|
|
|
export gcc_p
|
|
|
|
export mes_p
|
|
|
|
export mesc_p
|
|
|
|
export tcc_p
|
|
|
|
export mes_arch
|
|
|
|
export posix_p
|
|
|
|
|
|
|
|
CPPFLAGS=${CPPFLAGS-"
|
2018-07-21 22:43:39 +00:00
|
|
|
-D 'VERSION=\"$VERSION\"'
|
|
|
|
-D 'MODULEDIR=\"$moduledir\"'
|
|
|
|
-D 'PREFIX=\"$prefix\"'
|
2018-11-11 15:25:36 +00:00
|
|
|
-I ${srcdest}.
|
2018-07-25 06:14:13 +00:00
|
|
|
-I ${srcdest}lib
|
|
|
|
-I ${srcdest}include
|
2018-07-21 22:43:39 +00:00
|
|
|
"}
|
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
[ "$posix_p" ] && CPPFLAGS="$CPPFLAGS -D POSIX=1 -D WITH_GLIBC=1"
|
2018-07-21 22:43:39 +00:00
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
LDFLAGS=${LDFLAGS-"
|
|
|
|
-v
|
2018-11-11 15:25:36 +00:00
|
|
|
-g
|
2018-11-06 19:29:35 +00:00
|
|
|
-L lib/linux/$mes_arch
|
|
|
|
-L lib/linux
|
|
|
|
-L lib/$mes_arch
|
|
|
|
-L lib
|
2018-08-10 15:05:01 +00:00
|
|
|
"}
|
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
if [ -f "$MES_SEED/x86-mes/mes.S" ]; then
|
|
|
|
LDFLAGS="$LDFLAGS
|
|
|
|
-L $MES_SEED
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$gcc_p" ]; then
|
|
|
|
CFLAGS=${CFLAGS-"
|
|
|
|
-v
|
|
|
|
--std=gnu99
|
2018-08-10 15:05:01 +00:00
|
|
|
-O0
|
|
|
|
-g
|
2018-07-21 22:43:39 +00:00
|
|
|
"}
|
2018-11-06 19:29:35 +00:00
|
|
|
fi
|
2018-07-21 22:43:39 +00:00
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
if [ "$mes_p" -a "$gcc_p" ]; then
|
|
|
|
CFLAGS="$CFLAGS
|
2018-07-21 22:43:39 +00:00
|
|
|
-fno-builtin
|
|
|
|
-fno-stack-protector
|
|
|
|
-nostdinc
|
|
|
|
-nostdlib
|
|
|
|
-Wno-discarded-qualifiers
|
|
|
|
-Wno-int-to-pointer-cast
|
|
|
|
-Wno-pointer-to-int-cast
|
|
|
|
-Wno-pointer-sign
|
|
|
|
-Wno-int-conversion
|
|
|
|
-Wno-incompatible-pointer-types
|
2018-11-06 19:29:35 +00:00
|
|
|
"
|
|
|
|
fi
|
2018-07-21 22:43:39 +00:00
|
|
|
|
2018-11-06 19:29:35 +00:00
|
|
|
if [ "$arch" = "x86" ]; then
|
|
|
|
HEX2FLAGS=${HEX2FLAGS-"
|
2018-07-21 22:43:39 +00:00
|
|
|
--LittleEndian
|
|
|
|
--Architecture 1
|
2018-11-06 19:29:35 +00:00
|
|
|
--BaseAddress 0x1000000
|
2018-07-21 22:43:39 +00:00
|
|
|
"}
|
2018-11-06 19:29:35 +00:00
|
|
|
M1FLAGS=${M1FLAGS-"
|
2018-07-21 22:43:39 +00:00
|
|
|
--LittleEndian
|
|
|
|
--Architecture 1
|
2018-11-06 19:29:35 +00:00
|
|
|
"}
|
|
|
|
bits=32
|
|
|
|
elif [ "$arch" = "x86_64" ]; then
|
|
|
|
HEX2FLAGS=${HEX2FLAGS-"
|
|
|
|
--LittleEndian
|
|
|
|
--Architecture 2
|
2018-07-21 22:43:39 +00:00
|
|
|
--BaseAddress 0x1000000
|
|
|
|
"}
|
2018-11-06 19:29:35 +00:00
|
|
|
M1FLAGS=${M1FLAGS-"
|
|
|
|
--LittleEndian
|
|
|
|
--Architecture 2
|
|
|
|
"}
|
|
|
|
bits=64
|
|
|
|
fi
|