build: Simplify: cater for one compiler at a time.

* build-aux/build-cc.sh: Remove.
* build-aux/build-cc32.sh: Remove.
* build-aux/build-cc64.sh: Remove.
* build-aux/build-x86_64-mes.sh: Remove.
* build-aux/cc-mes.sh: Remove.
* build-aux/cc-x86_64-mes.sh: Remove.
* build-aux/cc32-mes.sh: Remove.
* build-aux/cc64-mes.sh: Remove.
* build-aux/test64.sh: Remove.
* build-aux/bootstrap-mes.sh: New file.
* build-aux/config.make.in: New file.
* build-aux/config.status.in: New file.
* build-aux/test-cc.sh: New file.
* .gitignore: Update.
* build-aux/GNUmakefile.in: Update.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-boot.sh: Update.
* build-aux/check-mes.sh: Update.
* build-aux/check-mescc.sh: Update.
* build-aux/check-tcc.sh: Update.
* build-aux/check.sh.in: Update.
* build-aux/config.sh: Update.
* build-aux/export.make: Update.
* build-aux/install.sh.in: Update.
* build-aux/pre-inst-env.in: Update.
* build-aux/test.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* module/mescc/i386/as.scm: Update.
* module/mescc/preprocess.scm: Update.
* module/mescc/x86_64/as.scm: Update.
* scripts/mescc.in: Update.
* tests/psyntax.test: Update.
This commit is contained in:
Jan Nieuwenhuizen 2018-11-06 20:29:35 +01:00
parent 172879360e
commit 6b5ac57602
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
36 changed files with 909 additions and 1318 deletions

42
.gitignore vendored
View file

@ -30,13 +30,27 @@
*.mini-M1
*.mini-guile
*.mini-hex2
*.a
*.o
*.seed-out
*.stderr
*.stdout
*.x86-out
*.x86-mes-E
*.x86-mes-S
*.x86-mes-gcc-a
*.x86-mes-gcc-o
*.x86-mes-gcc-out
*.x86-mes-gcc-stdout
*.x86-mes-o
*.x86-mes-out
*.x86-mes-stdout
*.x86_64-mes-E
*.x86_64-mes-S
*.x86_64-mes-gcc-a
*.x86_64-mes-gcc-o
*.x86_64-mes-gcc-out
*.x86_64-mes-gcc-stdout
@ -45,9 +59,28 @@
*.x86_64-mes-stdout
*.x86_64-out
/lib/x86-mes/0exit-42
/lib/x86-mes/exit-42
/scaffold/argv
/scaffold/hello
/scaffold/main
/scaffold/malloc
/scaffold/micro-mes
/scaffold/tiny-mes
/scaffold/mini-mes
/scaffold/x86-mes-*
/scaffold/x86_64-mes-*
/scaffold/tests/x86-mes-*
/scaffold/tests/[0-9a][0-9a-z]-[^.]*
/src/*.h
/src/*.i
/src/mes
/src/x86-mes-mes
/src/x86_64-mes-mes
/.config.make
/.store
@ -75,16 +108,17 @@
/doc/mescc.1
/doc/version.texi
/config.status
/pre-inst-env
/build.sh
/check.sh
/install.sh
/uninstall.sh
/mes/module/mes/boot-0.scm
/scripts/mescc
/doc/images/gcc-mesboot-graph.png
/GNUmakefile
/build.sh
/check.sh
/install.sh
/pre-inst-env
/uninstall.sh
/doc/images/gcc-mesboot-graph.eps
/doc/images/gcc-mesboot-graph.pdf
/doc/web/

View file

@ -82,39 +82,21 @@ doc: build
build:
./build.sh
src/mes: build
gcc:
${srcdest}build-aux/build-cc.sh
mes-gcc:
${srcdest}build-aux/build-cc32.sh
x86_64-mes-gcc:
${srcdest}build-aux/build-cc64.sh
mes-tcc:
ifdef TCC
CC32=$(TCC) ${srcdest}build-aux/build-cc32.sh
else
$(warning skipping mes-tcc: no tcc)
endif
mes:
${srcdest}build-aux/build-mes.sh
x86_64-mes:
${srcdest}build-aux/build-x86_64-mes.sh
src/${program_prefix}mes: build
clean:
git clean -dfx\
-e .config.make\
-e config.status\
-e GNUmakefile\
-e build.sh\
-e check.sh\
-e install.sh\
-e pre-inst-env\
-e uninstall.sh\
-e pre-inst-env\
-e scripts/mescc\
-e "mes"/module/mes/boot-0.scm\
#
# Mes does not cache anything on the file system; therefore clean
@ -151,30 +133,6 @@ install:
uninstall:
./uninstall.sh
seed: all-go gcc mes-gcc x86_64-mes-gcc mes-tcc
cd $(MES_SEED) && git reset --hard HEAD
$(MAKE) MES=guile MES_SEED= SEED=1 mes
cp -v lib/x86-mes/*.S $(MES_SEED)/x86-mes
cp -v src/mes.S $(MES_SEED)/x86-mes
$(MAKE) MES=guile MES_SEED= SEED=1 x86_64-mes
cp -v lib/x86_64-mes/*.S $(MES_SEED)/x86_64-mes
cp -v src/mes.x86_64-mes-S $(MES_SEED)/x86_64-mes/mes.S
MES=$(GUILE) GUILE=$(GUILE) SEED=1 MES_SEED= ${srcdest}build-aux/build-mes.sh
MES=$(GUILE) GUILE=$(GUILE) SEED=1 MES_SEED= ${srcdest}build-aux/build-x86_64-mes.sh
cd $(MES_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-mes.sh
cd $(MES_SEED) && MES_PREFIX=$(PWD) arch=x86_64-mes ./refresh.sh
MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-x86_64-mes.sh
cp lib/x86-mes/libc+tcc.S\
lib/x86-mes/libc.S\
lib/x86-mes/crt1.S\
lib/x86-mes/libgetopt.S\
$(MESCC_TOOLS_SEED)/libs
cd $(MESCC_TOOLS_SEED) && MES_PREFIX=$(PWD) ./bootstrap.sh
ifdef TCC
cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
endif
doc/version.texi: ${srcdest}doc/mes.texi GNUmakefile
@mkdir -p $(@D)
(set `LANG= date -r $< +'%d %B %Y'`;\
@ -234,10 +192,10 @@ man: doc/mes.1 doc/mescc.1
%: %.o
%: %.c
doc/mes.1: src/mes | build
doc/mes.1: src/${program_prefix}mes | build
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
doc/mescc.1: scripts/mescc src/mes | build
doc/mescc.1: scripts/mescc src/${program_prefix}mes | build
MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) $(<F) > $@
html: doc/html/index.html
@ -320,7 +278,7 @@ tag:
git tag -s v$(VERSION) -m "GNU Mes $(VERSION)."
# Release process
# 0. doc: Release update, Release commit, make seed, test guix bootstrap
# 0. doc: Release update, Release commit, test guix bootstrap
# 1. make tag
# 2. make dist
# 3. make release
@ -376,12 +334,8 @@ Usage: make [OPTION]... [TARGET]...
Main and non-standard targets:
all update everything
all-go update .go files
gcc update src/mes.gcc-out
dist update $(TARBALL)
doc update documentation
mes-gcc update src/mes.mes-gcc-out
mes-tcc update src/mes.mes-tcc-out
mes update src/mes
check run unit tests
clean run git clean -dfx
clean-go clean .go files
@ -389,7 +343,6 @@ Main and non-standard targets:
install install in $(prefix)
install-info install info docs in $(prefix)/share/info
release dist and tag
seed update mes-seed in $(MES_SEED)
uninstall uninstall from $(prefix)
endef
export HELP_TOP

101
build-aux/bootstrap-mes.sh Executable file
View file

@ -0,0 +1,101 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,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/>.
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
set -e
# FIXME?
#mes_program_prefix=boot-$arch-
mes_program_prefix=$program_prefix
trace "HEX2 0exit-42" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/$mes_arch/elf$bits-0header.hex2\
-f ${srcdest}lib/$mes_arch/elf$bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_arch/elf-0footer.hex2\
--exec_enable\
-o lib/$mes_arch/${mes_program_prefix}0exit-42
trace "TEST lib/$mes_arch/${mes_program_prefix}0exit-42" echo lib/$mes_arch/${mes_program_prefix}0exit-42
{ set +e; lib/$mes_arch/${mes_program_prefix}0exit-42; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
trace "HEX2 exit-42" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/$mes_arch/elf$bits-header.hex2\
-f ${srcdest}lib/$mes_arch/elf$bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_arch/elf$bits-footer-single-main.hex2\
--exec_enable\
-o lib/$mes_arch/${mes_program_prefix}exit-42
trace "TEST lib/$mes_arch/${mes_program_prefix}exit-42" echo lib/$mes_arch/${mes_program_prefix}exit-42
{ set +e; lib/$mes_arch/${mes_program_prefix}exit-42; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
mkdir -p lib/$mes_arch
trace "M1 crt1.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/crt1.S\
-o lib/$mes_arch/crt1.o
trace "M1 libc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/libc.S\
-o lib/$mes_arch/libc.o
trace "M1 mes.S" $M1\
--LittleEndian\
--Architecture 1\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/mes.S\
-o src/mes.o
trace "BLOOD_ELF mes.S" $BLOOD_ELF\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/mes.S\
-f $MES_SEED/$mes_arch/libc.S\
-o src/mes.S.blood-elf
trace "M1 mes.blood-elf" $M1\
--LittleEndian\
--Architecture 1\
-f src/mes.S.blood-elf\
-o src/mes.o.blood-elf
trace "HEX2 mes.o" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/$mes_arch/elf$bits-header.hex2\
-f lib/$mes_arch/crt1.o\
-f lib/$mes_arch/libc.o\
-f src/mes.o\
-f src/mes.o.blood-elf\
--exec_enable\
-o src/${mes_program_prefix}mes
#cp src/${mes_program_prefix}mes src/${program_prefix}mes
trace "M1 libc+tcc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/libc+tcc.S\
-o lib/$mes_arch/libc+tcc.o
trace "M1 libc+gnu.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/$mes_arch/$arch.M1\
-f $MES_SEED/$mes_arch/libc+gnu.S\
-o lib/$mes_arch/libc+gnu.o

View file

@ -1,59 +0,0 @@
#! /bin/sh
# 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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
LIBC=${LIBC-c}
##moduledir=${moduledir-${datadir}${datadir:+/}module}
sh ${srcdest}build-aux/snarf.sh --mes
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/x86-mes-gcc/crt0
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/x86-mes-gcc/crt1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/x86-mes-gcc/crti
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/linux/x86-mes-gcc/crtn
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc-mini
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libtcc1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libg
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libgetopt
LIBC= sh ${srcdest}build-aux/cc32-mes.sh scaffold/main
LIBC=c-mini sh ${srcdest}build-aux/cc32-mes.sh scaffold/hello
LIBC=c-mini sh ${srcdest}build-aux/cc32-mes.sh scaffold/argv
sh ${srcdest}build-aux/cc32-mes.sh scaffold/read
sh ${srcdest}build-aux/cc32-mes.sh scaffold/malloc
sh ${srcdest}build-aux/cc32-mes.sh scaffold/micro-mes
sh ${srcdest}build-aux/cc32-mes.sh scaffold/tiny-mes
sh ${srcdest}build-aux/cc32-mes.sh scaffold/mini-mes
sh ${srcdest}build-aux/cc32-mes.sh src/mes
if [ "$CC32" = "$TCC" ]; then
cp src/mes.mes-tcc-out src/mes
else
cp src/mes.mes-gcc-out src/mes
fi

View file

@ -1,54 +0,0 @@
#! /bin/sh
# 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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
LIBC=${LIBC-c}
# cc64-mes
sh ${srcdest}build-aux/snarf.sh --mes
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/linux/x86_64-mes-gcc/crt0
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/linux/x86_64-mes-gcc/crt1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/linux/x86_64-mes-gcc/crti
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/linux/x86_64-mes-gcc/crtn
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc-mini
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libtcc1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libg
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libgetopt
LIBC= sh ${srcdest}build-aux/cc64-mes.sh scaffold/main
LIBC=c-mini sh ${srcdest}build-aux/cc64-mes.sh scaffold/hello
LIBC=c-mini sh ${srcdest}build-aux/cc64-mes.sh scaffold/argv
sh ${srcdest}build-aux/cc64-mes.sh scaffold/read
sh ${srcdest}build-aux/cc64-mes.sh scaffold/malloc
sh ${srcdest}build-aux/cc64-mes.sh scaffold/micro-mes
sh ${srcdest}build-aux/cc64-mes.sh scaffold/tiny-mes
# sh ${srcdest}build-aux/cc64-mes.sh scaffold/cons-mes
sh ${srcdest}build-aux/cc64-mes.sh scaffold/mini-mes
sh ${srcdest}build-aux/cc64-mes.sh src/mes
cp src/mes.x86_64-mes-gcc-out src/mes

View file

@ -18,12 +18,12 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
. ${srcdest}build-aux/trace.sh
if [ ! "$config_status" ]; then
. ./config.status
fi
export GUILE
export GUILE_AUTO_COMPILE
GUILE=${GUILE-$(command -v guile)}
GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)}
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE_AUTO_COMPILE=0
set -e
@ -58,12 +58,10 @@ if [ "$GUILE_EFFECTIVE_VERSION" = "2.0" ]; then
srcdest=$abs_top_srcdir/
fi
GUILE_AUTO_COMPILE=0
for i in $SCM_FILES $SCRIPTS; do
b=$(basename $i)
go=${i%%.scm}.go
if [ $i -nt $go ]; then
trace "GUILEC $b" $GUILE_TOOLS compile -L ${srcdest}module -L ${srcdest}build-aux -L ${srcdest}scripts -o $go $i
trace "GUILEC $b" $GUILD compile -L ${srcdest}module -L ${srcdest}build-aux -L ${srcdest}scripts -o $go $i
fi
done

View file

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -18,134 +18,65 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE=${GUILE-guile}
if [ -z "$GUILE" -o "$GUILE" = "true" ] || ! command -v $GUILE > /dev/null; then
GUILE=src/mes
fi
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=src/mes
set -e
trace "HEX2 0exit-42" $HEX2\
--LittleEndian\
--Architecture 1\
--BaseAddress 0x1000000\
-f ${srcdest}lib/x86-mes/elf32-0header.hex2\
-f ${srcdest}lib/x86-mes/elf32-body-exit-42.hex2\
-f ${srcdest}lib/x86-mes/elf-0footer.hex2\
--exec_enable\
-o lib/x86-mes/0exit-42.x86-out
trace "TEST lib/x86-mes/0exit-42.x86-out" echo lib/x86-mes/0exit-42.x86-out
{ set +e; lib/x86-mes/0exit-42.x86-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
trace "HEX2 0exit-42" $HEX2\
--LittleEndian\
--Architecture 1\
--BaseAddress 0x1000000\
-f ${srcdest}lib/x86-mes/elf32-header.hex2\
-f ${srcdest}lib/x86-mes/elf32-body-exit-42.hex2\
-f ${srcdest}lib/x86-mes/elf32-footer-single-main.hex2\
--exec_enable\
-o lib/x86-mes/exit-42.x86-out
trace "TEST lib/x86-mes/exit-42.x86-out" echo lib/x86-mes/exit-42.x86-out
{ set +e; lib/x86-mes/exit-42.x86-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
if [ -d "$MES_SEED" ]; then
mkdir -p lib/x86-mes
trace "M1 crt1.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/crt1.S\
-o lib/x86-mes/crt1.o
trace "M1 libc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/libc.S\
-o lib/x86-mes/libc.o
trace "M1 mes.S" $M1\
--LittleEndian\
--Architecture 1\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/mes.S\
-o src/mes.o
trace "BLOOD_ELF mes.S" $BLOOD_ELF\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/mes.S\
-f $MES_SEED/x86-mes/libc.S\
-o src/mes.S.blood-elf
trace "M1 mes.blood-elf" $M1\
--LittleEndian\
--Architecture 1\
-f src/mes.S.blood-elf\
-o src/mes.o.blood-elf
trace "HEX2 mes.o" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/x86-mes/elf32-header.hex2\
-f lib/x86-mes/crt1.o\
-f lib/x86-mes/libc.o\
-f src/mes.o\
-f src/mes.o.blood-elf\
--exec_enable\
-o src/mes.seed-out
cp src/mes.seed-out src/mes
trace "M1 libc+tcc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/x86-mes/x86.M1\
-f $MES_SEED/x86-mes/libc+tcc.S\
-o lib/x86-mes/libc+tcc.o
if [ ! "$config_status" ]; then
. ./config.status
fi
PREPROCESS=1
if [ ! -d "$MES_SEED" ] \
&& [ "$arch" = "i386" \
-o "$arch" = "i586" \
-o "$arch" = "i686" ]; then
MES_ARENA=100000000
fi
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/cc.sh
MES_ARENA=100000000
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/x86-mes/crt1
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc-mini
MES_LIBS='-l c-mini' PREPROCESS= bash ${srcdest}build-aux/cc-mes.sh lib/x86-mes/exit-42
[ "$mes_p" ] && (program_prefix= compile lib/linux/$mes_arch/crt1)
[ "$mes_p" -a ! "$gcc_p" ] && cp -f lib/linux/$mes_arch/crt1.S lib/$mes_arch/crt1.S
[ "$mes_p" -a ! "$gcc_p" ] && cp -f lib/linux/$mes_arch/crt1.o lib/$mes_arch/crt1.o
trace "TEST lib/x86-mes/exit-42.mes-out" echo lib/x86-mes/exit-42.mes-out
{ set +e; lib/x86-mes/exit-42.mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
[ ! "$mesc_p" -a ! "$posix_p" ] && (program_prefix= compile lib/linux/$mes_arch/crt0)
[ "$mes_p" -a "$gcc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crti)
[ "$mes_p" -a "$gcc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crtn)
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libgetopt
[ ! "$mes_p" -a ! "$mesc_p" ] && compile lib/libmes
[ ! "$mes_p" -a ! "$mesc_p" ] && archive lib/libmes
MES_ARENA=${MES_ARENA-100000000}
sh ${srcdest}build-aux/snarf.sh --mes
[ "$mes_p" ] && compile lib/libc-mini
[ "$mes_p" ] && archive lib/libc-mini
if [ -n "$SEED" ]; then
bash ${srcdest}build-aux/cc-mes.sh src/mes
exit 0
fi
[ "$mes_p" ] && compile lib/libc
[ "$mes_p" ] && archive lib/libc
MES_LIBS='-l none' bash ${srcdest}build-aux/cc-mes.sh scaffold/main
[ "$mes_p" ] && compile lib/libc+tcc
[ "$mes_p" ] && archive lib/libc+tcc
trace "TEST scaffold/main.mes-out" echo scaffold/main.mes-out
{ set +e; scaffold/main.mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
[ "$mes_p" ] && compile lib/libc+gnu
[ "$mes_p" ] && archive lib/libc+gnu
MES_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-mes.sh scaffold/hello
MES_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-mes.sh scaffold/argv
bash ${srcdest}build-aux/cc-mes.sh scaffold/malloc
##sh ${srcdest}build-aux/cc-mes.sh scaffold/micro-mes
##sh ${srcdest}build-aux/cc-mes.sh scaffold/tiny-mes
# bash ${srcdest}build-aux/cc-mes.sh scaffold/mini-mes
bash ${srcdest}build-aux/cc-mes.sh src/mes
cp src/mes.mes-out src/mes
[ "$mes_p" -a ! "$mesc_p" ] && compile lib/libtcc1
[ "$mes_p" -a ! "$mesc_p" ] && archive lib/libtcc1
[ "$mes_p" -a ! "$mesc_p" ] && compile lib/libg
[ "$mes_p" -a ! "$mesc_p" ] && archive lib/libg
[ "$mes_p" -a ! "$mesc_p" ] && compile lib/libgetopt
[ "$mes_p" -a ! "$mesc_p" ] && archive lib/libgetopt
compile scaffold/main
(libc= link scaffold/main)
compile scaffold/hello
(libc="-l c-mini" link scaffold/hello)
compile scaffold/argv
(libc="-l c-mini" link scaffold/argv)
[ "$mes_p" ] && compile scaffold/malloc
[ "$mes_p" ] && link scaffold/malloc
[ "$mes_p" ] && compile scaffold/micro-mes
[ "$mes_p" ] && link scaffold/micro-mes
[ "$mes_p" ] && compile scaffold/tiny-mes
[ "$mes_p" ] && link scaffold/tiny-mes
[ "$mes_p" ] && compile scaffold/mini-mes
[ "$mes_p" ] && link scaffold/mini-mes
compile src/mes
link src/mes

View file

@ -1,147 +0,0 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,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/>.
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE=${GUILE-guile}
if [ -z "$GUILE" -o "$GUILE" = "true" ] || ! command -v $GUILE > /dev/null; then
GUILE=src/mes
fi
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=src/mes
set -e
trace "HEX2 0exit-42" $HEX2\
--LittleEndian\
--Architecture 2\
--BaseAddress 0x1000000\
-f ${srcdest}lib/x86_64-mes/elf64-0header.hex2\
-f ${srcdest}lib/x86_64-mes/elf64-body-exit-42.hex2\
-f ${srcdest}lib/x86_64-mes/elf-0footer.hex2\
--exec_enable\
-o lib/x86_64-mes/0exit-42.x86_64-out
trace "TEST lib/x86_64-mes/0exit-42.x86_64-out" echo lib/x86_64-mes/0exit-42.x86_64-out
{ set +e; lib/x86_64-mes/0exit-42.x86_64-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
trace "HEX2 0exit-42" $HEX2\
--LittleEndian\
--Architecture 2\
--BaseAddress 0x1000000\
-f ${srcdest}lib/x86_64-mes/elf64-header.hex2\
-f ${srcdest}lib/x86_64-mes/elf64-body-exit-42.hex2\
-f ${srcdest}lib/x86_64-mes/elf64-footer-single-main.hex2\
--exec_enable\
-o lib/x86_64-mes/exit-42.x86_64-out
trace "TEST lib/x86_64-mes/exit-42.x86_64-out" echo lib/x86_64-mes/exit-42.x86_64-out
{ set +e; lib/x86_64-mes/exit-42.x86_64-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
if [ -d "$MES_SEED" ]; then
mkdir -p lib/x86_64-mes
trace "M1 crt1.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/x86_64-mes/x86_64.M1\
-f $MES_SEED/x86_64-mes/crt1.S\
-o lib/x86_64-mes/crt1.o
trace "M1 libc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/x86_64-mes/x86_64.M1\
-f $MES_SEED/x86_64-mes/libc.S\
-o lib/x86_64-mes/libc.o
trace "M1 mes.S" $M1\
--LittleEndian\
--Architecture 2\
-f ${srcdest}lib/x86_64-mes/x86_64.M1\
-f $MES_SEED/x86_64-mes/mes.S\
-o src/mes.o
trace "BLOOD_ELF mes.S" $BLOOD_ELF\
-f ${srcdest}lib/x86_64-mes/x86_64.M1\
-f $MES_SEED/x86_64-mes/mes.S\
-f $MES_SEED/x86_64-mes/libc.S\
-o src/mes.S.blood-elf
trace "M1 mes.blood-elf" $M1\
--LittleEndian\
--Architecture 2\
-f src/mes.S.blood-elf\
-o src/mes.o.blood-elf
trace "HEX2 mes.o" $HEX2\
$HEX2FLAGS\
-f ${srcdest}lib/x86_64-mes/elf64-header.hex2\
-f lib/x86_64-mes/crt1.o\
-f lib/x86_64-mes/libc.o\
-f src/mes.o\
-f src/mes.o.blood-elf\
--exec_enable\
-o src/mes.seed-out
cp src/mes.seed-out src/mes
trace "M1 libc+tcc.S" $M1\
$M1FLAGS\
-f ${srcdest}lib/x86_64-mes/x86_64.M1\
-f $MES_SEED/x86_64-mes/libc+tcc.S\
-o lib/x86_64-mes/libc+tcc.o
fi
PREPROCESS=1
MES_ARENA=100000000
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/linux/x86_64-mes/crt1
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc-mini
MES_LIBS='-l c-mini' PREPROCESS= bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/x86_64-mes/exit-42
trace "TEST lib/x86_64-mes/exit-42.x86_64-mes-out" echo lib/x86_64-mes/exit-42.x86_64-mes-out
{ set +e; lib/x86_64-mes/exit-42.x86_64-mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libgetopt
MES_ARENA=${MES_ARENA-100000000}
sh ${srcdest}build-aux/snarf.sh --mes
if [ -n "$SEED" ]; then
bash ${srcdest}build-aux/cc-mes.sh src/mes
exit 0
fi
MES_LIBS='-l none' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/main
trace "TEST scaffold/main.x86_64-mes-out" echo scaffold/main.x86_64-mes-out
{ set +e; scaffold/main.x86_64-mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
MES_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/hello
MES_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/argv
bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/malloc
sh ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/micro-mes
sh ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/tiny-mes
bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/mini-mes
bash ${srcdest}build-aux/cc-x86_64-mes.sh src/mes
# not yet, broken
# cp src/mes.x86_64-mes-out src/mes

59
build-aux/build.sh.in Executable file → Normal file
View file

@ -1,7 +1,7 @@
#! @BASH@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -18,42 +18,43 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
VERSION=${VERSION-@VERSION@}
arch=${arch-@arch@}
set -e
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES_SEED=${MES_SEED-../mes-seed}
GUILE=${GUILE-$(command -v guile)}
MES_ARENA=${MES_ARENA-100000000}
if [ -n "$GUILE" -a "$GUILE" != true ]; then
sh ${srcdest}build-aux/build-guile.sh
fi
if [ -n "$CC" ]; then
sh ${srcdest}build-aux/build-cc.sh
if [ ! "$mes_p" ]; then
sh ${srcdest}build-aux/snarf.sh
#elif [ ! -d "$MES_SEED" ]; then
#else
fi
sh ${srcdest}build-aux/snarf.sh --mes
if [ "$gcc_p$tcc_p" ]; then
sh ${srcdest}build-aux/build-mes.sh
elif [ -d "$MES_SEED" ]; then
sh ${srcdest}build-aux/bootstrap-mes.sh
fi
if [ -n "$CC32" ]; then
sh ${srcdest}build-aux/build-cc32.sh
fi
if [ -n "$CC64" ]; then
sh ${srcdest}build-aux/build-cc64.sh
fi
if [ -n "$TCC" ]; then
CC32=$TCC sh ${srcdest}build-aux/build-cc32.sh
fi
## FIXME: remove this and have user configure/build/install for each compiler?
unset CFLAGS CPPFLAGS LDFLAGS gcc_p tcc_p posix_p
MES=guile
mesc_p=1
mes_p=1
mes_arch=x86-mes
program_prefix=$mes_arch-
CC="./pre-inst-env mescc"
sh ${srcdest}build-aux/build-mes.sh
if [ "$arch" = x86_64 -a "$GUILE" ]; then
MES=$GUILE sh ${srcdest}build-aux/build-x86_64-mes.sh
cp src/${program_prefix}mes src/mes
if [ "$arch" = x86_64 ]; then
MES_CFLAGS='-m 64'
mes_arch=x86_64-mes
program_prefix=$mes_arch-
sh ${srcdest}build-aux/build-mes.sh
fi

View file

@ -1,67 +0,0 @@
#! /bin/sh
# 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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MESCC=${MESCC-$(command -v mescc)}
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=src/mes
if [ "$V" = 2 ]; then
MES_CFLAGS="$MES_CFLAGS -v"
fi
c=$1
set -e
if [ -z "$ARCHDIR" ]; then
o="$c"
d=${c%%/*}
p="mes-"
else
b=${c##*/}
d=${c%%/*}/x86-mes
o="$d/$b"
fi
mkdir -p $d
if [ -n "$PREPROCESS" ]; then
trace "CPP.mes $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -E -o "$o.E" "${srcdest}$c".c
trace "CC.mes $c.E" ./pre-inst-env bash $MESCC $MES_CFLAGS -S "$o".E
trace "AS.mes $c.S" ./pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
if [ -z "$NOLINK" ]; then
trace "LD.mes $c.o" ./pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
elif [ -n "$COMPILE" ]; then
trace "CC.mes $c.c" trace "MESCC $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -S -o "$o.S" "${srcdest}$c".c
trace "AS.mes $c.S" ./pre-inst-env bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S
if [ -z "$NOLINK" ]; then
trace "LD.mes $c.o" ./pre-inst-env bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
elif [ -z "$NOLINK" ]; then
trace "CC.mes $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -o "$o".${p}out "${srcdest}$c".c $MES_LIBS
else
trace "CC.mes $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -c -o "$o".${p}o "${srcdest}$c".c
fi

View file

@ -1,67 +0,0 @@
#! /bin/sh
# 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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MESCC=${MESCC-$(command -v mescc)}
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=src/mes
if [ "$V" = 2 ]; then
MES64_CFLAGS="$MES64_CFLAGS -v"
fi
c=$1
set -e
if [ -z "$ARCHDIR" ]; then
o="$c"
d=${c%%/*}
p="x86_64-mes-"
else
b=${c##*/}
d=${c%%/*}/x86_64-mes
o="$d/$b"
fi
mkdir -p $d
if [ -n "$PREPROCESS" ]; then
trace "CPP.mes64 $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -E -o "$o.${p}E" "${srcdest}$c".c
trace "CC.mes64 $c.E" ./pre-inst-env bash $MESCC $MES64_CFLAGS -S -o "$o".${p}S "$o".${p}E
trace "AS.mes64 $c.S" ./pre-inst-env bash $MESCC $MES64_CFLAGS -c -o "$o".${p}o "$o".${p}S
if [ -z "$NOLINK" ]; then
trace "LD.mes64 $c.o" ./pre-inst-env bash $MESCC $MES64_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
elif [ -n "$COMPILE" ]; then
trace "CC.mes64 $c.c" trace "MESCC $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -S -o "$o".${p}S "${srcdest}$c".c
trace "AS.mes64 $c.S" ./pre-inst-env bash $MESCC $MES64_CFLAGS -c -o "$o".${p}o "$o".${p}S
if [ -z "$NOLINK" ]; then
trace "LD.mes64 $c.o" ./pre-inst-env bash $MESCC $MES64_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
elif [ -z "$NOLINK" ]; then
trace "CC.mes64 $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -o "$o".${p}out "${srcdest}$c".c $MES_LIBS
else
trace "CC.mes64 $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -c -o "$o".${p}o "${srcdest}$c".c
fi

View file

@ -1,5 +1,3 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
@ -18,42 +16,32 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
compile () {
flags=
[ "$mesc_p" ] && flags="$LDFLAGS $MES_CFLAGS"
trace "CC $1.c" $CC -c $CPPFLAGS $CFLAGS $flags -o "$1".${program_prefix}o "${srcdest}$1".c
}
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/config.sh
archive () {
l=$1
shift
objects=$(for i in $@; do echo $i.${program_prefix}o; done)
[ -z "$objects" ] && objects=$l.${program_prefix}o
out=$(dirname "$l")/$mes_arch/$(basename "$l").a
d=$(dirname $out)
mkdir -p $d
if [ "$mesc_p" ]; then
trace "AR $l.a" mv $l.${program_prefix}o $(dirname $l)/$mes_arch/$(basename $l).o\
&& mv $l.${program_prefix}S $(dirname $l)/$mes_arch/$(basename $l).S
else
trace "AR $l.a" $AR cr $out $objects\
&& mv $objects $d
fi
}
c=$1
if [ -z "$ARCHDIR" ]; then
o="$c"
d=${c%%/*}
p="gcc-"
else
b=${c##*/}
d=${c%/*}/gcc
o="$d/$b"
fi
mkdir -p $d
trace "CC $c.c" $CC\
-c\
$CC_CPPFLAGS\
$CPPFLAGS\
$CC_CFLAGS\
$CFLAGS\
-D WITH_GLIBC=1\
-D POSIX=1\
-o "$o".${p}o\
"${srcdest}$c".c
if [ -z "$NOLINK" ]; then
trace "CCLD "$o".${p}out" $CC\
$CC_CPPFLAGS\
$CPPFLAGS\
$CC_CFLAGS\
$CFLAGS\
-o "$o".${p}out\
"$o".${p}o\
lib/gcc/libmes.o
fi
link () {
lib=$libc
[ "$posix_p" ] && lib='-l mes'
out=$(dirname "$1")/${program_prefix}$(basename "$1")
trace "CCLD $1" $CC $CFLAGS $LDFLAGS -o" $out" $crt1 "$1".${program_prefix}o $2 $lib
}

View file

@ -1,65 +0,0 @@
#! /bin/sh
# 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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
a=mes-gcc
if [ "$CC32" = "$TCC" ]; then
a=mes-tcc
LIBC=c+tcc # tcc bug with undefined symbols
fi
arch=x86-$a
if [ -n "$LIBC" ]; then
CC32LIBS="lib/$arch/lib$LIBC.o"
fi
c=$1
if [ -z "$ARCHDIR" ]; then
o="$c"
d=${c%%/*}
p="$a-"
else
b=${c##*/}
d=${c%%/*}/$arch
o="$d/$b"
fi
mkdir -p $d
trace "CC.32 $c.c" $CC32\
-c\
$CC32_CPPFLAGS\
$CC32_CFLAGS\
-o "$o".${p}o\
"${srcdest}$c".c
if [ -z "$NOLINK" ]; then
trace "CCLD.32 $c.c" $CC32\
$CC32_CPPFLAGS\
$CC32_CFLAGS\
-o "$o".${p}out\
lib/$arch/crt1.o\
"$o".${p}o\
$CC32LIBS
fi

View file

@ -1,64 +0,0 @@
#! /bin/sh
# 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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
arch=x86_64-mes-gcc
if [ "$CC64" = "$TCC" ]; then
arch=x86_64-mes-tcc
LIBC=c+tcc # tcc bug with undefined symbols
fi
if [ -n "$LIBC" ]; then
CC64LIBS="lib/$arch/lib$LIBC.o"
fi
c=$1
if [ -z "$ARCHDIR" ]; then
o="$c"
d=${c%%/*}
p="$arch-"
else
b=${c##*/}
d=${c%%/*}/$arch
o="$d/$b"
fi
mkdir -p $d
trace "CC.64 $c.c" $CC64\
-c\
$CC64_CPPFLAGS\
$CC64_CFLAGS\
-o "$o".${p}o\
"${srcdest}$c".c
if [ -z "$NOLINK" ]; then
trace "CCLD.64 $c.c" $CC64\
$CC64_CPPFLAGS\
$CC64_CFLAGS\
-o "$o".${p}out\
lib/$arch/crt1.o\
"$o".${p}o\
$CC64LIBS
fi

View file

@ -20,17 +20,10 @@
set -e
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
export GUILE MES
MES=${MES-./src/mes}
GUILE=${GUILE-guile}
if ! command -v $GUILE > /dev/null; then
GUILE=true
fi
tests="
00-zero.scm
@ -120,18 +113,17 @@ for i in $tests; do
echo ' [SKIP]'
continue;
fi
trace "TEST $i.guile" $GUILE -L ${srcdest}module -C module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i)
x=$(
if [ "$MES" = guile ]; then
true
if [ "$MES" = guile -o "$(basename $MES)" = guile ]; then
trace "TEST $i.guile" $GUILE -L ${srcdest}module -C module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i)
elif [ -z "${i/5[0-9]-*/}" ]; then
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-00.scm $MES 2>&1;
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-00.scm trace "TEST $i" $MES 2>&1;
elif [ -z "${i/6[0-9]-*/}" ]; then
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-01.scm $MES 2>&1;
cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-01.scm trace "TEST $i" $MES 2>&1;
else
MES_BOOT=${srcdest}scaffold/boot/$i $MES 2>&1;
MES_BOOT=${srcdest}scaffold/boot/$i trace "TEST $i" $MES 2>&1;
fi
) \
&& echo ' [PASS]' \
&& echo ' [OK]' \
|| (r=$?; echo ' [FAIL]'; echo -e "$x"; echo scaffold/boot/$i; exit $r)
done

View file

@ -20,17 +20,10 @@
set -e
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
if [ "$MES" = guile ]; then
mes=guile-
fi
BASH=${BASH-bash}
GUILE=${GUILE-guile}
MES=${MES-src/mes}
MES_ARENA=${MES_ARENA-100000000}
tests="
tests/boot.test
tests/read.test

View file

@ -19,31 +19,11 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES=${MES-src/mes}
[ -z "$MESCC" ] && MESCC=scripts/mescc
GUILE=${GUILE-guile}
MES_PREFIX=${MES_PREFIX-mes}
HEX2=${HEX2-hex2}
M1=${M1-M1}
BLOOD_ELF=${BLOOD_ELF-blood-elf}
MES_SEED=${MES_SEED-../mes-seed}
MESCC=${MESCC-$(command -v mescc)}
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=src/mes
if ! command -v $GUILE > /dev/null; then
GUILE=true
fi
test_sh=${test_sh-${srcdest}build-aux/test.sh}
if [ "$arch" = "x86_64-mes" ]; then
test_sh=${srcdest}build-aux/test64.sh
fi
tests="
t
@ -237,8 +217,18 @@ a0-call-trunc-int
a0-math-divide-signed-negative
"
# gcc not supported
CC=
if [ "$mes_arch" = "x86_64-gcc" ]; then
broken="$broken
21-char[]
41-?
70-printf-stdarg
70-printf-simple
70-printf
80-setjmp
a1-global-no-align
"
fi
set +e
expect=$(echo $broken | wc -w)
pass=0
@ -247,20 +237,15 @@ total=0
mkdir -p scaffold/tests
for t in $tests; do
if [ -z "${t/[012][0-9]-*/}" ]; then
LIBC=
MES_LIBS="-l none"
libc=
elif [ -z "${t/[34][0-9]-*/}" ]; then
LIBC=c-mini
MES_LIBS="-l c-mini"
libc='-l c-mini'
elif [ -z "${t/[78][0-9a-z]-*/}" ]; then
LIBC=c+tcc
MES_LIBS="-l c+tcc"
elif [ -z "${t/9[0-9]-*/}" ]; then
LIBC=c+gnu
MES_LIBS="-l c+gnu"
libc='-l c+tcc'
elif [ -z "${t/9[0-9a-z]-*/}" ]; then
libc='-l c+gnu'
else
LIBC=c
MES_LIBS=
libc='-l c'
fi
sh $test_sh "scaffold/tests/$t" &> scaffold/tests/"$t".log
r=$?

View file

@ -19,27 +19,10 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES=${MES-src/mes}
[ -z "$MESCC" ] && MESCC=scripts/mescc
GUILE=${GUILE-guile}
MES_PREFIX=${MES_PREFIX-mes}
HEX2=${HEX2-hex2}
M1=${M1-M1}
BLOOD_ELF=${BLOOD_ELF-blood-elf}
MES_SEED=${MES_SEED-../mes-seed}
MESCC=${MESCC-$(command -v mescc)}
[ -z "$MESCC" ] && MESCC=scripts/mescc
MES=${MES-$(command -v mes)}
[ -z "$MES" ] && MES=src/mes
if ! command -v $GUILE > /dev/null; then
GUILE=true
fi
tests="
00_assignment
01_comment

31
build-aux/check.sh.in Executable file → Normal file
View file

@ -20,34 +20,13 @@
set -e
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
GUILE=${GUILE-guile}
MES=${MES-src/mes}
MES_ARENA=${MES_ARENA-100000000}
TCC_PREFIX=${TCC_PREFIX-${srcdest}../tinycc}
if ! command -v $GUILE > /dev/null; then
GUILE=true
fi
set -e
if [ "$GUILE" != true ]; then
MES=guile bash ${srcdest}build-aux/check-mes.sh
fi
if [ "$MES" != guile ]; then
bash ${srcdest}build-aux/check-mes.sh
fi
bash ${srcdest}build-aux/check-boot.sh
bash ${srcdest}build-aux/check-mescc.sh
./pre-inst-env bash ${srcdest}build-aux/check-boot.sh
./pre-inst-env bash ${srcdest}build-aux/check-mes.sh
./pre-inst-env bash ${srcdest}build-aux/check-mescc.sh
if [ -d $TINYCC_PREFIX/tests/tests2 ] ;then
bash ${srcdest}build-aux/check-tcc.sh
./pre-inst-env bash ${srcdest}build-aux/check-tcc.sh
fi

72
build-aux/config.make.in Normal file
View file

@ -0,0 +1,72 @@
# 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/>.
AR:=@AR@
BASH:=@BASH@
BLOOD_ELF:=@BLOOD_ELF@
CC:=@CC@
DOT:=@DOT@
GIT:=@GIT@
GUILD:=@GUILD@
GUILE:=@GUILE@
GUILE_EFFECTIVE_VERSION:=@GUILE_EFFECTIVE_VERSION@
GUIX:=@GUIX@
HELP2MAN:=@HELP2MAN@
HEX2:=@HEX2@
#HEX2FLAGS:=@HEX2FLAGS@
MAKEINFO:=@MAKEINFO@
M1:=@M1@
#M1FLAGS:=@M1FLAGS@
MES:=@MES@
MES_FOR_BUILD:=@MES_FOR_BUILD@
MES_SEED:=@MES_SEED@
NYACC:=@NYACC@
PACKAGE:=@PACKAGE@
PERL:=@PERL@
TINYCC_PREFIX:=@TINYCC_PREFIX@
VERSION:=@VERSION@
abs_top_builddir:=@abs_top_builddir@
abs_top_srcdir:=@abs_top_srcdir@
arch:=@arch@
build:=@build@
host:=@host@
mes_arch:=@mes_arch@
gcc_p:=@gcc_p@
mes_p:=@mes_p@
mesc_p:=@mesc_p@
tcc_p:=@tcc_p@
prefix:=@prefix@
bindir:=@bindir@
datadir:=@datadir@
docdir:=@docdir@
guile_site_ccache_dir:=@guile_site_ccache_dir@
guile_site_dir:=@guile_site_dir@
infodir:=@infodir@
libdir:=@libdir@
mandir:=@mandir@
moduledir:=@moduledir@
posix_p:=@posix_p@
program_prefix:=@program_prefix@
srcdest:=@srcdest@
srcdir:=@srcdir@
sysconfdir:=@sysconfdir@
top_builddir:=@top_builddir@

View file

@ -18,60 +18,72 @@
srcdir=${srcdir-.}
top_builddir=${top_builddir-.}
if [ "$V" = 2 ]; then
echo $0
echo srcdest=${srcdest}
echo top_builddir=${top_builddir}
fi
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
export CC
export CC CFLAGS
export CC32
export CC32_CPPFLAGS
export CC64
export CC64_CPPFLAGS
export CC_CFLAGS
export CC_CPPFLAGS
export CFLAGS
export CPPFLAGS
export GUILD
export GUILE
export GUILE_LOAD_COMPILED_PATH
export GUILE_LOAD_PATH
export HEX2
export HEX2FLAGS
export LIBC
export M1
export M1FLAGS
export MES
export MES_CFLAGS
export MES_CPPFLAGS
export MES_LIBS
export TCC
export MES_FOR_BUILD
export MES_SEED
export MESCC
export MES_DEBUG
export MES_SEED
export MES_ARENA
export COMPILE
export PREPROCESS
export TINYCC_PREFIX
export V
export config_status
export abs_top_builddir
export abs_top_srcdir
export arch
export datadir
export moduledir
export prefix
export program_prefix
export srcdest
export srcdir
export top_builddir
MESCC=${MESCC-mescc}
BLOOD_ELF=${BLOOD_ELF-blood-elf}
HEX2=${HEX2-hex2}
M1=${M1-M1}
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
CC_CPPFLAGS=${CC_CPPFLAGS-"
CPPFLAGS=${CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
@ -81,29 +93,35 @@ CC_CPPFLAGS=${CC_CPPFLAGS-"
-I ${srcdest}include
"}
CC_CFLAGS=${CC_CFLAGS-"
[ "$posix_p" ] && CPPFLAGS="$CPPFLAGS -D POSIX=1 -D WITH_GLIBC=1"
LDFLAGS=${LDFLAGS-"
-v
-L lib/linux/$mes_arch
-L lib/linux
-L lib/$mes_arch
-L lib
"}
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
-O0
-g
"}
fi
CC64_CPPFLAGS=${CC64_CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
-I src
-I ${srcdest}src
-I ${srcdest}lib
-I ${srcdest}include
"}
CC64_CFLAGS=${CC64_CFLAGS-"
-std=gnu99
-O0
if [ "$mes_p" -a "$gcc_p" ]; then
CFLAGS="$CFLAGS
-fno-builtin
-fno-stack-protector
-g
-m64
-nostdinc
-nostdlib
-Wno-discarded-qualifiers
@ -112,59 +130,29 @@ CC64_CFLAGS=${CC64_CFLAGS-"
-Wno-pointer-sign
-Wno-int-conversion
-Wno-incompatible-pointer-types
"}
"
fi
CC32_CPPFLAGS=${CC32_CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
-I src
-I ${srcdest}src
-I ${srcdest}lib
-I ${srcdest}include
"}
CC32_CFLAGS=${CC32_CFLAGS-"
-std=gnu99
-O0
-fno-builtin
-fno-stack-protector
-g
-m32
-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
"}
MES_CPPFLAGS=${MES_CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
-D 'MODULEDIR=\"$moduledir\"'
-D 'PREFIX=\"$prefix\"'
-I src
-I ${srcdest}src
-I ${srcdest}lib
-I ${srcdest}include
"}
MES_CFLAGS=${MES_CFLAGS-"
"}
MES64_CFLAGS=${MES64_CFLAGS-"
-m64
"}
M1FLAGS=${M1FLAGS-"
--LittleEndian
--Architecture 1
"}
HEX2FLAGS=${HEX2FLAGS-"
if [ "$arch" = "x86" ]; then
HEX2FLAGS=${HEX2FLAGS-"
--LittleEndian
--Architecture 1
--BaseAddress 0x1000000
"}
M1FLAGS=${M1FLAGS-"
--LittleEndian
--Architecture 1
"}
bits=32
elif [ "$arch" = "x86_64" ]; then
HEX2FLAGS=${HEX2FLAGS-"
--LittleEndian
--Architecture 2
--BaseAddress 0x1000000
"}
M1FLAGS=${M1FLAGS-"
--LittleEndian
--Architecture 2
"}
bits=64
fi

View file

@ -0,0 +1,72 @@
# 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/>.
config_status=1
AR="@AR@"
BASH="@BASH@"
BLOOD_ELF="@BLOOD_ELF@"
CC="@CC@"
DOT="@DOT@"
GIT="@GIT@"
GUILD="@GUILD@"
GUILE="@GUILE@"
GUILE_EFFECTIVE_VERSION="@GUILE_EFFECTIVE_VERSION@"
GUIX="@GUIX@"
HELP2MAN="@HELP2MAN@"
HEX2="@HEX2@"
#HEX2FLAGS="@HEX2FLAGS@"
MAKEINFO="@MAKEINFO@"
M1="@M1@"
#M1FLAGS="@M1FLAGS@"
MES_FOR_BUILD="@MES_FOR_BUILD@"
MES_SEED="@MES_SEED@"
NYACC="@NYACC@"
PACKAGE="@PACKAGE@"
PERL="@PERL@"
TINYCC_PREFIX="@TINYCC_PREFIX@"
VERSION="@VERSION@"
abs_top_builddir="@abs_top_builddir@"
abs_top_srcdir="@abs_top_srcdir@"
arch="@arch@"
build="@build@"
host="@host@"
mes_arch="@mes_arch@"
gcc_p="@gcc_p@"
mes_p="@mes_p@"
mesc_p="@mesc_p@"
tcc_p="@tcc_p@"
prefix="@prefix@"
bindir="@bindir@"
datadir="@datadir@"
docdir="@docdir@"
guile_site_ccache_dir="@guile_site_ccache_dir@"
guile_site_dir="@guile_site_dir@"
infodir="@infodir@"
libdir="@libdir@"
mandir="@mandir@"
moduledir="@moduledir@"
posix_p="@posix_p@"
program_prefix="@program_prefix@"
srcdest="@srcdest@"
srcdir="@srcdir@"
sysconfdir="@sysconfdir@"
top_builddir="@top_builddir@"

View file

@ -56,10 +56,6 @@ ifdef CC
export CC
endif
ifdef CC32
export CC32
endif
ifdef CC64
export CC64
endif
@ -80,6 +76,18 @@ ifdef MES
export MES
endif
ifdef MES_FOR_BUILD
export MES_FOR_BUILD
endif
ifdef MES_SEED
export MES_SEED
endif
ifdef MESCC
export MESCC
endif
ifdef HEX2
export HEX2
endif
@ -92,8 +100,8 @@ ifdef GUILE
export GUILE
endif
ifdef GUILE_TOOLS
export GUILE_TOOLS
ifdef GUILD
export GUILD
endif
ifdef GUIX
@ -124,14 +132,6 @@ ifdef CPPFLAGS
export CPPFLAGS
endif
ifdef CC32_CFLAGS
export CC32_CFLAGS
endif
ifdef CC64_CFLAGS
export CC64_CFLAGS
endif
ifdef HEX2FLAGS
export HEX2FLAGS
endif
@ -140,22 +140,6 @@ ifdef M1FLAGS
export M1FLAGS
endif
ifdef MES_CFLAGS
export MES_CFLAGS
endif
ifdef MES_SEED
export MES_SEED
endif
ifdef MESCC_TOOLS_SEED
export MESCC_TOOLS_SEED
endif
ifdef TINYCC_SEED
export TINYCC_SEED
endif
ifdef TINYCC_PREFIX
export TINYCC_PREFIX
endif

19
build-aux/install.sh.in Executable file → Normal file
View file

@ -19,13 +19,8 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
VERSION=${VERSION-@VERSION@}
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
@ -35,8 +30,6 @@ SHELL=${SHELL-$(command -v sh)}
[ -n "$BASH" ] && set -o pipefail
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
MES_SEED=${MES_SEED-../MES-SEED}
TINYCC_SEED=${TINYCC_SEED-../TINYCC-SEED}
GUILE=${GUILE-$(command -v guile)} || true
if [ -z "$GUILE" -o "$GUILE" = true ]; then
@ -54,7 +47,9 @@ guile_site_dir=$(eval echo ${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFE
guile_site_ccache_dir=$(eval echo ${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache})
mkdir -p $DESTDIR$bindir
cp src/mes $DESTDIR$bindir/mes
if [ -f src/x86-mes-mes ]; then
cp src/x86-mes-mes $DESTDIR$bindir/mes
fi
cp scripts/mescc $DESTDIR$bindir/mescc
sed \
@ -66,7 +61,7 @@ mkdir -p $docdir
if [ -n "$PERL" -a -n "$GIT" ]\
&& $PERL -v > /dev/null\
&& $GIT --status > /dev/null; then
&& $GIT status > /dev/null; then
$PERL ${srcdest}build-aux/gitlog-to-changelog --srcdir=. > ChangeLog
fi
@ -105,7 +100,9 @@ else
fi
tar -cf- -C ${srcdest}mes module | tar -xf- -C $DESTDIR$MES_PREFIX
cp src/mes.S $DESTDIR$MES_PREFIX/lib/x86-mes/mes.S
if [ -f src/mes.x86-mes-S ]; then
cp src/mes.x86-mes-S $DESTDIR$MES_PREFIX/lib/x86-mes/mes.S
fi
if [ -f src/mes.x86_64-mes-S ]; then
cp src/mes.x86_64-mes-S $DESTDIR$MES_PREFIX/lib/x86_64-mes/mes.S
fi

View file

@ -22,6 +22,7 @@ srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
program_prefix=${program_prefix-@program_prefix@}
MES_PREFIX=${MES_PREFIX-${srcdest}mes}
export MES_PREFIX
@ -36,7 +37,7 @@ export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
PATH="$abs_top_builddir/scripts:$abs_top_builddir/src:$abs_top_builddir/build-aux:$PATH"
export PATH
MES=${MES-src/mes}
MES=${MES-${abs_top_builddir}/src/${program_prefix}mes}
export MES
GUIX_PACKAGE_PATH="$abs_top_srcdir/guix${GUIX_PACKAGE_PATH:+:}$GUIX_PACKAGE_PATH"

View file

@ -20,12 +20,30 @@
set -e
if [ ! "$config_status" ]; then
. ./config.status
fi
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/cc.sh
# native
sh ${srcdest}build-aux/snarf.sh
t=${1-scaffold/tests/t}
o="$t"
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc.sh lib/libmes
sh ${srcdest}build-aux/cc.sh src/mes
cp src/mes.gcc-out src/mes
rm -f "${program_prefix}$o"
compile "$t"
link "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
$(dirname "$o")/${program_prefix}$(basename "$o") $ARGS > "$o".${program_prefix}stdout
m=$?
cat "$o".${program_prefix}stdout
set -e
[ $m = $r ]
if [ -f "$t".expect ]; then
$DIFF -ub "$t".expect "$o".${program_prefix}stdout
fi

View file

@ -19,67 +19,19 @@
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
set -e
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES_ARENA=100000000
sh ${srcdest}build-aux/test-cc.sh $1
GUILE=${GUILE-$MES}
DIFF=${DIFF-$(command -v diff)} || true
[ -z "$DIFF" ] && DIFF="sh scripts/diff.scm"
t=${1-scaffold/tests/t}
o="$t"
rm -f "$o".mes-out
rm -f "$o".gcc-out
if [ -n "$CC" ]; then
sh ${srcdest}build-aux/cc.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
"$o".gcc-out $ARGS > "$o".gcc-stdout
m=$?
cat "$o".gcc-stdout
set -e
[ $m = $r ]
if [ -f "$t".expect ]; then
$DIFF -ub "$t".expect "$o".gcc-stdout;
fi
fi
rm -f "$t".mes-gcc-out
if [ -n "$CC32" ]; then
sh ${srcdest}build-aux/cc32-mes.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
"$o".mes-gcc-out $ARGS > "$o".mes-gcc-stdout
m=$?
cat "$t".mes-gcc-stdout
set -e
[ $m = $r ]
if [ -f "$t".expect ]; then
$DIFF -ub "$t".expect "$o".mes-gcc-stdout;
fi
fi
rm -f "$o".mes-out
sh ${srcdest}build-aux/cc-mes.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
"$o".mes-out $ARGS > "$o".mes-stdout
m=$?
cat "$o".mes-stdout
set -e
[ $m = $r ]
if [ -f "$t".expect ]; then
$DIFF -ub "$t".expect "$o".mes-stdout;
if [ ! "$mesc_p" ]; then
#FIXME: c&p
unset CFLAGS CPPFLAGS LDFLAGS gcc_p tcc_p posix_p
MES=guile
mesc_p=1
mes_p=1
mes_arch=x86-mes
program_prefix=$mes_arch-
CC="./pre-inst-env mescc"
sh ${srcdest}build-aux/test-cc.sh $1
fi

View file

@ -1,85 +0,0 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,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/>.
set -e
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
MES_ARENA=100000000
GUILE=${GUILE-$MES}
DIFF=${DIFF-$(command -v diff)} || true
[ -z "$DIFF" ] && DIFF="sh scripts/diff.scm"
t=${1-scaffold/tests/t}
o="$t"
rm -f "$o".mes-out
rm -f "$o".gcc-out
if [ -n "$CC" ]; then
sh ${srcdest}build-aux/cc.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
"$o".gcc-out $ARGS > "$o".gcc-stdout
m=$?
cat "$o".gcc-stdout
set -e
[ $m = $r ]
if [ -f "$t".expect ]; then
$DIFF -ub "$t".expect "$o".gcc-stdout;
fi
fi
rm -f "$t".x86_64-mes-gcc-out
if [ -n "$CC64" ]; then
sh ${srcdest}build-aux/cc64-mes.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
"$o".x86_64-mes-gcc-out $ARGS > "$o".x86_64-mes-gcc-stdout
m=$?
cat "$t".x86_64-mes-gcc-stdout
set -e
[ $m = $r ]
if [ -f "$t".expect ]; then
$DIFF -ub "$t".expect "$o".x86_64-mes-gcc-stdout;
fi
fi
rm -f "$o".x86_64-mes-out
sh ${srcdest}build-aux/cc-x86_64-mes.sh "$t"
r=0
[ -f "$t".exit ] && r=$(cat "$t".exit)
set +e
"$o".x86_64-mes-out $ARGS > "$o".x86_64-mes-stdout
m=$?
cat "$o".x86_64-mes-stdout
set -e
[ $m = $r ]
if [ -f "$t".expect ]; then
$DIFF -ub "$t".expect "$o".x86_64-mes-stdout;
fi

25
build-aux/uninstall.sh.in Executable file → Normal file
View file

@ -20,12 +20,7 @@
#set -e
srcdest="@srcdest@"
srcdir="@srcdir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
prefix=${prefix-@prefix@}
. ./config.status
. ${srcdest}build-aux/config.sh
. ${srcdest}build-aux/trace.sh
@ -44,15 +39,11 @@ moduledir=${moduledir-$datadir/mes/module}
guile_site_dir=${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION}
guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
mkdir -p $DESTDIR$prefix/bin
cp src/mes $DESTDIR$prefix/bin/mes
mkdir -p $DESTDIR$prefix/lib
mkdir -p $DESTDIR$MES_PREFIX/lib
cp scripts/mescc $DESTDIR$prefix/bin/mescc
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
rm $DESTDIR$prefix/bin/mes
rm $DESTDIR$prefix/bin/mescc
rm -f $DESTDIR$prefix/bin/diff.scm
rmdir $DESTDIR$prefix/bin || :
for i in\
@ -77,6 +68,16 @@ rm -r $DESTDIR$guile_site_ccache_dir/mescc
rm -r $DESTDIR$guile_site_dir/mes
rm -r $DESTDIR$guile_site_dir/mescc
rm $DESTDIR$prefix/share/info/dir
rm $DESTDIR$prefix/share/info/mes.info*
rm $DESTDIR$prefix/share/info/images/gcc-mesboot*
rm $DESTDIR$prefix/share/info/images/README
rm $DESTDIR$mandir/man1/mes.1
rm $DESTDIR$mandir/man1/mescc.1
rmdir -p $DESTDIR$prefix/share/doc
rmdir -p $DESTDIR$prefix/share/info/images
rmdir -p $DESTDIR$guile_site_dir
rmdir -p $DESTDIR$guile_site_ccache_dir
rmdir -p $DESTDIR$mandir/man1
true

296
configure vendored
View file

@ -123,7 +123,7 @@ exec ${guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
;;; Configure
(define-immutable-record-type <dependency>
(make-depedency name version-expected optional? version-option commands file-name)
(make-depedency name version-expected optional? version-option commands file-name data)
dependency?
(name dependency-name)
(version-expected dependency-version-expected)
@ -131,13 +131,14 @@ exec ${guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
(optional? dependency-optional?)
(commands dependency-commands)
(file-name dependency-file-name)
(version-found dependency-version-found))
(version-found dependency-version-found)
(data dependency-data))
(define* (make-dep name #:optional (version '(0))
#:key optional? (version-option "--version") (commands (list name)) file-name)
#:key optional? (version-option "--version") (commands (list name)) file-name data)
(let* ((env-var (getenv (name->shell-name name)))
(commands (if env-var (cons env-var commands) commands)))
(make-depedency name version optional? version-option commands file-name)))
(make-depedency name version optional? version-option commands file-name data)))
(define (find-dep name deps)
(find (compose (cut equal? <> name) dependency-name) deps))
@ -174,7 +175,7 @@ exec ${guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
(let loop ((commands commands))
(if (null? commands) dependency
(let ((command (car commands)))
(stdout "checking for ~a~a... " command
(stdout "checking for ~a~a... " name
(if (null? expected) ""
(format #f " [~a]" (version->string expected))))
(let* ((output (gulp-pipe (format #f "~a ~a 2>&1" command version-option)))
@ -195,23 +196,47 @@ exec ${guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"}
(stdout "~a\n" (or file-name ""))
(set-field dependency (dependency-file-name) file-name)))
(define* (check-header-c dependency #:optional (check check-compile-header-c))
(define* (check-header-c cc dependency #:optional (check check-preprocess-header-c))
(let ((name (dependency-name dependency)))
(stderr "checking for ~a..." name)
(let ((result (check name)))
(let ((result (check cc name)))
(stderr " ~a\n" (if result "yes" "no"))
(if result (set-field dependency (dependency-file-name) name)
dependency-file-name))))
dependency))))
(define (check-compile-header-c header)
(zero? (system (format #f "echo '#include ~s' | gcc -E - > /dev/null 2>&1" header))))
(define* (check-compile-c cc dependency #:optional (check check-compile-string-c))
(let ((name (dependency-name dependency)))
(stderr "checking for ~a..." name)
(let ((result (check cc (dependency-data dependency))))
(stderr " ~a\n" (if result "yes" "no"))
(if result (set-field dependency (dependency-file-name) name)
dependency))))
(define* (check-link-c cc dependency #:optional (check check-link-string-c))
(let ((name (dependency-name dependency)))
(stderr "checking for ~a..." name)
(let ((result (check cc (dependency-data dependency))))
(stderr " ~a\n" (if result "yes" "no"))
(if result (set-field dependency (dependency-file-name) name)
dependency))))
(define (check-preprocess-header-c cc header)
(zero? (system (format #f "echo '#include \"~a\"' | ~a -E - > /dev/null 2>&1" header cc))))
(define (check-compile-string-c cc string)
(zero? (system (format #f "echo '~a' | ~a --std=gnu99 -c -x c -o .config.o - > /dev/null 2>&1" string cc))))
(define (check-link-string-c cc string)
(zero? (system (format #f "echo '~a' | ~a -v --std=gnu99 -x c -o .config-a.out - > /dev/null 2>&1" string cc))))
(define (parse-opts args)
(let* ((option-spec
'((build (value #t))
(host (value #t))
(help (single-char #\h))
(mes)
(prefix (value #t))
(program-prefix (value #t))
(bindir (value #t))
(datadir (value #t))
(docdir (value #t))
@ -254,8 +279,9 @@ Options:
-h, --help display this help
--build=BUILD configure for building on BUILD [guessed]
--disable-silent-rules
verbose build output [BUILD_DEBUG=1]
verbose build output [V=1]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--mes use Mes C Library
-v, --verbose be verbose
--with-courage assert being courageous to configure for unsupported platform
--with-cheating cheat using Guile instead of Mes
@ -265,6 +291,10 @@ Installation directories:
--infodir=DIR info documentation [PREFIX/share/info]
--mandir=DIR man pages [PREFIX/share/man]
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
Ignored for Guix:
--enable-fast-install
@ -280,29 +310,23 @@ Ignored for Debian:
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
CC32 x86 C compiler command
CC64_CFLAGS x86_64 C compiler flags
CC64 x86_64 C compiler command
CC32_CFLAGS x86 C compiler flags
GUILE guile command
GUILE_TOOLS guile-tools command
MES_CFLAGS MesCC flags
GUILD guild command
MES_FOR_BUILD build system MES [can be mes or guile]
MES_SEED location of mes-seed
MESCC_TOOLS_SEED location of mescc-tools-seed
TCC tcc C compiler command
TINYCC_PREFIX location of tinycc [for tests/test2]
TINYCC_SEED location of tinycc-seed
" PACKAGE VERSION (getenv "prefix")))
(define (main args)
(let* ((options (parse-opts args))
(build-type (option-ref options 'build %host-type))
(arch (car (string-split build-type #\-)))
(host-type (option-ref options 'host %host-type))(prefix "/usr/local")
(prefix "/usr/local")
(prefix (option-ref options 'prefix prefix))
(program-prefix (option-ref options 'program-prefix ""))
(program-suffix (option-ref options 'program-suffix ""))
(infodir (option-ref options 'infodir "${prefix}/share/info"))
(mandir (option-ref options 'infodir "${prefix}/share/man"))
(sysconfdir (option-ref options 'sysconfdir "${prefix}/etc"))
@ -332,7 +356,8 @@ Some influential environment variables:
(disable-silent-rules? (option-ref options 'disable-silent-rules #f))
(enable-silent-rules? (option-ref options 'enable-silent-rules #f))
(vars (filter (cut string-index <> #\=) (option-ref options '() '())))
(help? (option-ref options 'help #f)))
(help? (option-ref options 'help #f))
(mes? (option-ref options 'mes #f)))
(when help?
(print-help)
(exit 0))
@ -342,37 +367,28 @@ Some influential environment variables:
(for-each (lambda (v) (apply setenv (string-split v #\=))) vars)
(let* ((mes-seed (or (getenv "MES_SEED")
(string-append srcdest "../mes-seed")))
(mes-seed (and mes-seed
(file-exists? (string-append mes-seed "/x86-mes/mes.S"))
mes-seed))
(tinycc-prefix (or (getenv "TINYCC_PREFIX")
(string-append srcdest "../tinycc-prefix")))
(tinycc-seed (or (getenv "TINYCC_SEED")
(string-append srcdest "../tinycc-seed")))
(mescc-tools-seed (or (getenv "MESCC_TOOLS_SEED")
(string-append srcdest "../mescc-tools-seed")))
(gcc (or (getenv "CC") "gcc"))
(tcc (or (getenv "TCC") "tcc"))
(mescc (or (getenv "MESCC") "mescc"))
(deps (fold (lambda (program results)
(cons (check-program-version program) results))
'()
(list (make-dep "guile" '(2 0) #:commands '("guile-2.2" "guile-2.0" "guile-2" "guile"))
(make-dep "guix" '(0 13) #:optional? #t)
(make-dep "bash" '(2 0) #:optional? #t)
(make-dep "guile-tools" '(2 0))
(make-dep "mes-seed" '(0 18) #:optional? #t
#:commands (list (string-append mes-seed "/refresh.sh"))
#:file-name mes-seed)
(make-dep "tinycc-seed" '(0 18) #:optional? #t
#:commands (list (string-append tinycc-seed "/refresh.sh"))
#:file-name tinycc-seed)
(make-dep "cc" '(2 95) #:commands '("gcc"))
(make-dep "make" '(4))
(make-dep "cc32" '(2 95)
#:optional? #t
#:commands '("i686-unknown-linux-gnu-gcc"))
(make-dep "cc64" '(2 95)
#:optional? #t
#:commands '("gcc"))
(list (make-dep "hex2" '(0 3))
(make-dep "M1" '(0 3))
(make-dep "blood-elf" '(0 1))
(make-dep "hex2" '(0 3))
(make-dep "tcc" '(0 9 26) #:optional? #t #:version-option "-v")
(make-dep "guile" '(2 0) #:commands '("guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t)
(make-dep "mes" '(0 18) #:optional? #t)
(make-dep "guix" '(0 13) #:optional? #t)
(make-dep "ar" '(2 10) #:optional? #t)
(make-dep "bash" '(2 0) #:optional? #t)
(make-dep "guild" '(2 0) #:commands '("guild" "guile-tools"))
(make-dep "cc" '(2 95) #:commands (list gcc tcc mescc) #:optional? #t)
(make-dep "make" '(4) #:optional? #t)
(make-dep "makeinfo" '(5) #:optional? #t)
(make-dep "dot" '(2) #:version-option "-V" #:optional? #t)
(make-dep "help2man" '(1 47) #:optional? #t)
@ -380,19 +396,55 @@ Some influential environment variables:
(make-dep "git" '(2) #:optional? #t))))
(deps (cons (check-program-version (make-dep "nyacc" '(0 86 0) #:commands (list (string-append (file-name "guile" deps) " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) #:file-name #t))
deps))
(deps (if (file-name "cc" deps)
(cons* (check-header-c (make-dep "stdio.h"))
(check-header-c (make-dep "limits.h"))
(cc (file-name "cc" deps))
(deps (if cc
(cons* (check-header-c cc (make-dep "limits.h"))
(check-header-c cc (make-dep "stdio.h" #:optional? #t))
deps)
deps))
(deps (cons (check-file (make-dep "mescc-tools-seed" '(0) #:optional? #t
#:file-name mescc-tools-seed))
deps))
(deps (cons (check-file (make-dep "tinycc-prefix" '(0) #:optional? #t
#:file-name tinycc-prefix))
deps))
(missing (filter (conjoin (negate dependency-file-name)
(negate dependency-optional?)) deps)))
(negate dependency-optional?)) deps))
(deps (if cc
(cons (check-compile-c cc (make-dep "cc is GNU C" #:data "#if !defined (__GNUC__)
#error no gnuc
#endif
"))
deps)
deps))
(gcc? (file-name "cc is GNU C" deps))
(deps (if cc
(cons (check-compile-c cc (make-dep "cc is Mes C" #:data "#if !defined (__MESC__)
#error no mesc
#endif
"))
deps)
deps))
(mesc? (file-name "cc is Mes C" deps))
(deps (if cc
(cons (check-compile-c cc (make-dep "cc is Tiny CC" #:data "#if !defined (__TINYCC__)
#error no tinycc
#endif
"))
deps)
deps))
(tcc? (file-name "cc is Tiny CC" deps))
(deps (if cc
(cons (check-link-c cc (make-dep "if cc can create executables" #:data "int main () {return 0;}"))
deps)
deps))
(mes? (or mes? (not (file-name "if cc can create executables" deps))))
(build-type (or (and cc (gulp-pipe* cc "-dumpmachine")) build-type))
(arch (car (string-split build-type #\-)))
(arch (if (member arch '("i386" "i486" "i586" "i686")) "x86"
arch))
(mes-arch arch)
(mes-arch (if mes? (string-append mes-arch "-mes") mes-arch))
(mes-arch (if gcc? (string-append mes-arch "-gcc") mes-arch))
(mes-arch (if tcc? (string-append mes-arch "-gcc") mes-arch))
(posix? (and (not mesc?) (not mes?))))
(define* (substitute file-name pairs
#:key (target (if (string-suffix? ".in" file-name)
@ -405,7 +457,7 @@ Some influential environment variables:
(regexp-substitute/global #f (car o) result 'pre (cdr o) 'post))
(with-input-from-file file-name read-string) pairs)))))
(when (and (not (member arch '("i686" "x86_64"))) (not with-courage?))
(when (and (not (member arch '("x86" "x86_64"))) (not with-courage?))
(stderr "platform not supported: ~a, try --with-courage\n" arch)
(exit 1))
(when (pair? missing)
@ -418,71 +470,72 @@ Some influential environment variables:
(and (zero? (system* "git" "init"))
(zero? (system* "git" "add" "."))
(zero? (system* "git" "commit" "--allow-empty" "-m" "Import mes")))))
(with-output-to-file ".config.make"
(lambda _
(stdout "PACKAGE:=~a\n" PACKAGE)
(stdout "VERSION:=~a\n" VERSION)
(stdout "arch:=~a\n" arch)
(stdout "build:=~a\n" build-type)
(stdout "host:=~a\n" host-type)
(let ((pairs `(("@PACKAGE@" . ,PACKAGE)
("@VERSION@" . ,VERSION)
(stdout "top_builddir:=~a\n" top-builddir)
(stdout "abs_top_builddir:=~a\n" abs-top-builddir)
(stdout "abs_top_srcdir:=~a\n" abs-top-srcdir)
("@arch@" . ,arch)
("@build@" . ,build-type)
("@host@" . ,host-type)
(stdout "srcdest:=~a\n" srcdest)
(stdout "srcdir:=~a\n" srcdir)
("@gcc_p@" . ,(if gcc? "1" ""))
("@mes_arch@" . ,mes-arch)
("@mes_p@" . ,(if mes? "1" ""))
("@mesc_p@" . ,(if mesc? "1" ""))
("@posix_p@" . ,(if posix? "1" ""))
("@tcc_p@" . ,(if tcc? "1" ""))
(stdout "prefix:=~a\n" (gulp-pipe (string-append "echo " prefix)))
(stdout "datadir:=~a\n" datadir)
(stdout "docdir:=~a\n" docdir)
(stdout "bindir:=~a\n" bindir)
(stdout "guile_site_ccache_dir:=~a\n" guile-site-ccache-dir)
(stdout "guile_site_dir:=~a\n" guile-site-dir)
(stdout "infodir:=~a\n" infodir)
(stdout "libdir:=~a\n" libdir)
(stdout "mandir:=~a\n" mandir)
(stdout "moduledir:=~a\n" moduledir)
(stdout "sysconfdir:=~a\n" sysconfdir)
(for-each (lambda (o)
(stdout "~a:=~a\n" (variable-name o) (or (dependency-file-name o) "")))
deps)
(stdout "GUILE_EFFECTIVE_VERSION:=~a\n" (effective-version))
(when disable-silent-rules?
(stdout "V:=1\n"))
(when with-cheating?
(stdout "MES:=guile\n"))
(for-each (lambda (o)
(stdout "~a:=~a\n" o (or (getenv o) "")))
'(
"CFLAGS"
"CC32_CFLAGS"
"CC64_CFLAGS"
"HEX2FLAGS"
"M1FLAGS"
"MES_CFLAGS"
))))
(let ((pairs `(("@srcdest@" . ,srcdest)
("@srcdir@" . ,srcdir)
("@abs_top_srcdir@" . ,abs-top-srcdir)
("@abs_top_builddir@" . ,abs-top-builddir)
("@top_builddir@" . ,top-builddir)
("@BASH@" . ,(file-name "bash" deps))
("@GUILE@" . ,(file-name "guile" deps))
("@MES@" . ,(file-name "guile" deps))
("@srcdest@" . ,srcdest)
("@srcdir@" . ,srcdir)
("@prefix@" . ,prefix)
("@guile_site_dir@" . ,guile-site-dir)
("@program_prefix@" . ,program-prefix)
("@bindir@" . ,bindir)
("@datadir@" . ,datadir)
("@docdir@" . ,docdir)
("@guile_site_ccache_dir@" . ,guile-site-ccache-dir)
("@VERSION@" . ,VERSION)
("@arch@" . ,arch)
("mes/module/" . ,(string-append moduledir/)))))
("@guile_site_dir@" . ,guile-site-dir)
("@infodir@" . ,infodir)
("@libdir@" . ,libdir)
("@mandir@" . ,mandir)
("@moduledir@" . ,moduledir)
("@sysconfdir@" . ,sysconfdir)
("@GUILE_EFFECTIVE_VERSION@" . ,(effective-version))
("@V@" . ,(if disable-silent-rules? 1 0))
("@AR@" . ,(or (file-name "ar" deps) ""))
("@BASH@" . ,(or (file-name "bash" deps) ""))
("@CC@" . ,(or (file-name "cc" deps) ""))
("@DOT@" . ,(Fileor -name "dot" deps))
("@GIT@" . ,(or (file-name "git" deps) ""))
("@GUILE@" . ,(file-name "guile" deps))
("@GUIX@" . ,(or (file-name "guix" deps) ""))
("@HELP2MAN@" . ,(or (file-name "help2man" deps) ""))
("@MAKEINFO@" . ,(or (file-name "makeinfo" deps) ""))
("@MES_FOR_BUILD@" . ,(or (file-name "mes" deps)
(file-name "guile" deps)))
("@MES_SEED@" . ,(or mes-seed ""))
("@PERL@" . ,(or (file-name "perl" deps) ""))
("@CFLAGS@" . ,(or (getenv "CFLAGS") ""))
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
("mes/module/" . ,(string-append moduledir/))
,@(map
(lambda (o)
(cons (string-append "@" (variable-name o) "@") (or (format #f "~a" (dependency-file-name o)) "")))
deps))))
(when (and (not cc)
(not mes-seed))
(format (current-error-port) "must supply C compiler or MES_SEED/x86-mes/mes.S\n")
(exit 2))
(for-each (lambda (o)
(let* ((src (string-append srcdest o))
(target (string-drop-right o 3))
@ -491,6 +544,7 @@ Some influential environment variables:
(substitute src pairs #:target target)))
'(
"build-aux/GNUmakefile.in"
"build-aux/config.status.in"
"build-aux/build.sh.in"
"build-aux/check.sh.in"
"build-aux/install.sh.in"
@ -498,17 +552,23 @@ Some influential environment variables:
"build-aux/uninstall.sh.in"
"mes/module/mes/boot-0.scm.in"
"scripts/mescc.in"
)))
(chmod "build.sh" #o755)
(chmod "check.sh" #o755)
(chmod "install.sh" #o755)
(chmod "pre-inst-env" #o755)
(chmod "uninstall.sh" #o755)
(chmod "scripts/mescc" #o755)
))
(chmod "pre-inst-env" #o755)
(chmod "scripts/mescc" #o755)
(chmod "build.sh" #o755)
(chmod "check.sh" #o755)
(chmod "install.sh" #o755)
(chmod "uninstall.sh" #o755)
(substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make"))
(let ((make (and=> (file-name "make" deps) basename)))
(format (current-output-port)
"\nRun:
"
GNU Mes is configured for ~a
Run:
~a to build mes
~a help for help on other targets\n"
mes-arch
(or make "./build.sh")
(or make "./build.sh"))))))

View file

@ -21,22 +21,56 @@
set -e
VERSION=0.18
# parse --prefix=prefix
cmdline=$(echo "$@")
p=${cmdline##*--prefix=}
p=${p% *}
p=${p% -*}
if [ -z "$p" ]; then
p=${prefix-/usr/local}
fi
prefix=$p
srcdir=${srcdir-$(dirname $0)}
. ${srcdest}build-aux/trace.sh
# parse --mes
cmdline=$(echo " $@")
p=${cmdline/ --mes/}
if [ "$p" != "$cmdline" ]; then
mes_p=${mes_p-1}
fi
# parse --prefix=PREFIX
p=${cmdline/ --prefix=/ -prefix=}
if [ "$p" != "$cmdline" ]; then
p=${p##* -prefix=}
p=${p% *}
p=${p% -*}
prefix=${p-/usr/local}
else
prefix=${prefix-/usr/local}
fi
# parse --program-prefix=
p=${cmdline/ --program-prefix=/ -program-prefix=}
if [ "$p" != "$cmdline" ]; then
p=${p##* -program-prefix=}
p=${p% *}
p=${p% -*}
program_prefix=$p
fi
AR=${AR-$(command -v ar)} || true
BASH=${BASH-$(command -v bash)}
BLOOD_ELF=${BLOOD_ELF-$(command -v blood-elf)}
CC=${CC-$(command -v gcc)} || true
GUILD=${GUILD-$(command -v guild)} || true
GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} || true
if [ ! "$GUILD" ]; then
if [ "$GUILE_TOOLS" ]; then
GUILD=$GUILE_TOOLS
else
GUILD=true
fi
fi
GUILE=${GUILE-$(command -v guile)} || true
HEX2=${HEX2-$(command -v hex2)}
M1=${M1-$(command -v M1)}
MES_FOR_BUILD=${MES_FOR_BUILD-$(command -v mes || command -v guile || echo mes)}
PERL=${PERL-$(command -v perl)} || true
MES_SEED=${MES_SEED-../mes-seed}
if [ "$srcdir" = . ]; then
top_builddir=.
@ -52,48 +86,127 @@ if [ -z "$GUILE" -o "$GUILE" = true ]; then
else
GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')}
fi
bindir=$(eval echo ${bindir-$prefix/bin})
datadir=$(eval echo ${datadir-$prefix/share})
docdir=$(eval echo ${docdir-$datadir/doc/mes-$VERSION})
infodir=$(eval echo ${infodir-$datadir/info})
libdir=$(eval echo ${libdir-$prefix/lib})
mandir=$(eval echo ${mandir-$datadir/man})
moduledir=$(eval echo ${moduledir-$datadir/mes/module})
moduledir_="$moduledir/"
guile_site_dir=$(eval echo ${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION})
guile_site_ccache_dir=$(eval echo ${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache})
arch=$(get_machine || uname -m)
subst () {
sed \
-e s,"@srcdest@,$srcdest,"\
-e s,"@srcdir@,$srcdir,"\
-e s,"@PACKAGE@,$PACKAGE,"\
-e s,"@VERSION@,$VERSION,"\
-e s,"@arch@,$arch,"\
-e s,"@build@,$build,"\
-e s,"@host@,$host,"\
-e s,"@compiler@,$compiler,"\
-e s,"@gcc_p@,$gcc_p,"\
-e s,"@mes_p@,$mes_p,"\
-e s,"@mesc_p@,$mesc_p,"\
-e s,"@tcc_p@,$tcc_p,"\
-e s,"@mes_arch@,$mes_arch,"\
-e s,"@posix_p@,$posix_p,"\
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
-e s,"@top_builddir@,$top_builddir,"\
-e s,"@BASH@,$BASH,"\
-e s,"@GUILE@,$GUILE,"\
-e s,"@srcdest@,$srcdest,"\
-e s,"@srcdir@,$srcdir,"\
-e s,"@prefix@,$prefix,"\
-e s,"@program_prefix@,$program_prefix,"\
-e s,"@bindir@,$bindir,"\
-e s,"@datadir@,$datadir,"\
-e s,"@docdir@,$docdir,"\
-e s,"@guile_site_dir@,$guile_site_dir,"\
-e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\
-e s,"@VERSION@,$VERSION,"\
-e s,"@arch@,$arch,"\
-e s,"@infodir@,$infodir,"\
-e s,"@libdir@,$libdir,"\
-e s,"@mandir@,$mandir,"\
-e s,"@moduledir@,$moduledir,"\
-e s,"@sysconfdir@,$sysconfdir,"\
-e s,"@GUILE_EFFECTIVE_VERSION@,$GUILE_EFFECTIVE_VERSION,"\
-e s,"@V@,$V,"\
-e s,"@AR@,$AR,"\
-e s,"@BASH@,$BASH,"\
-e s,"@BLOOD_ELF@,$BLOOD_ELF,"\
-e s,"@CC@,$CC,"\
-e s,"@GUILD@,$GUILD,"\
-e s,"@GUILE@,$GUILE,"\
-e s,"@PERL@,$PERL,"\
-e s,"@CFLAGS@,$CFLAGS,"\
-e s,"@HEX2@,$HEX2,"\
-e s,"@HEX2FLAGS@,$HEX2FLAGS,"\
-e s,"@M1@,$M1,"\
-e s,"@M1FLAGS@,$M1FLAGS,"\
-e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\
-e s,"@MES_SEED@,$MES_SEED,"\
-e s,"mes/module/,$moduledir/,"\
$1 > $2
}
subst ${srcdest}build-aux/pre-inst-env.in pre-inst-env
chmod +x pre-inst-env
subst ${srcdest}mes/module/mes/boot-0.scm.in mes/module/mes/boot-0.scm
subst ${srcdest}scripts/mescc.in scripts/mescc
subst ${srcdest}build-aux/GNUmakefile.in GNUmakefile
subst ${srcdest}build-aux/build.sh.in build.sh
subst ${srcdest}build-aux/check.sh.in check.sh
subst ${srcdest}build-aux/install.sh.in install.sh
subst ${srcdest}build-aux/uninstall.sh.in uninstall.sh
chmod +x scripts/mescc
host=${host-$($CC -dumpmachine 2>/dev/null || echo x86)}
if [ -z "$host" ]; then
arch=${arch-$(get_machine || uname -m)}
else
arch=${host%%-*}
fi
if [ "$arch" = i386\
-o "$arch" = i486\
-o "$arch" = i586\
-o "$arch" = i686\
]; then
arch=x86
fi
#
if $CC --version | grep gcc 2>/dev/null; then
gcc_p=1
compiler=gcc
elif $CC --version | grep tcc 2>/dev/null; then
tcc_p=1
compiler=tcc
else
mes_p=1
mesc_p=1
compiler=mescc
fi
mes_arch=$arch
if [ "$mes_p" -o "$mesc_p" ]; then
mes_arch=$arch-mes
fi
if [ ! "$mesc_p" ]; then
mes_arch=$mes_arch-$compiler
fi
if [ ! "$mesc_p" -a ! "$mes_p" ]; then
posix_p=1
fi
subst ${srcdest}mes/module/mes/boot-0.scm.in mes/module/mes/boot-0.scm
subst ${srcdest}build-aux/GNUmakefile.in GNUmakefile
subst ${srcdest}build-aux/config.status.in config.status
subst ${srcdest}build-aux/build.sh.in build.sh
chmod +x build.sh
subst ${srcdest}build-aux/check.sh.in check.sh
chmod +x check.sh
subst ${srcdest}build-aux/install.sh.in install.sh
chmod +x install.sh
subst ${srcdest}build-aux/uninstall.sh.in uninstall.sh
chmod +x uninstall.sh
cat <<EOF
GNU Mes is configured for $mes_arch
Run:
./build.sh to build mes
./check.sh to check mes

View file

@ -540,6 +540,7 @@
(define (i386:r2->r0 info)
(let ((r0 (get-r0 info))
(r1 (get-r1 info))
(allocated (.allocated info)))
(if (> (length allocated) 2)
(let ((r2 (cadddr allocated)))

View file

@ -53,7 +53,7 @@
(let loop ((ix 0))
(when (< ix n)
(if (memq ix need-progress)
(vector-set
(vector-set!
act-v ix
(lambda args
(progress (list-ref args (1- (vector-ref len-v ix))))

View file

@ -124,7 +124,7 @@
(define (x86_64:label->arg info label i)
(let ((r0 (list-ref x86_64:registers (1+ i))))
(if (< (label v) #x80000000)
(if (< label #x80000000)
`((,(string-append "mov____$i32,%" r0) (#:address ,label)))
`((,(string-append "mov____$i64,%" r0) (#:address8 ,label))))))
@ -668,6 +668,7 @@
(define (x86_64:r2->r0 info)
(let ((r0 (get-r0 info))
(r1 (get-r1 info))
(allocated (.allocated info)))
(if (> (length allocated) 2)
(let ((r2 (cadddr allocated)))

View file

@ -4,6 +4,7 @@ if [ "$V" = 2 ]; then
set -x
fi
prefix=${prefix-@prefix@}
program_prefix=${program_prefix-@program_prefix@}
MES_PREFIX=${MES_PREFIX-$prefix/share/mes}
export MES_PREFIX
mes_p=$(command -v mes)

View file

@ -1,6 +1,6 @@
#! /bin/sh
# -*-scheme-*-
exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests psyntax)' -s "$0" "$@"
MES_ARENA=${MES_ARENA-10000000} exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests psyntax)' -s "$0" "$@"
!#
;;; -*-scheme-*-