From c8e87f3021804b81fefcf0244484e34e83c120ab Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 20 Oct 2016 22:03:17 +0200 Subject: [PATCH] Switch fat-c/boot using environment variable BOOT. * GNUmakefile: check for BOOT, set CFLAGS. * mes.c: Remove hardcoded BOOT define. * scripts/include.mes: include loop-0 when BOOT is set. --- GNUmakefile | 9 +++++++-- mes.c | 1 - scripts/include.mes | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index ce2cc5b1..e08f6841 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,6 +10,11 @@ CFLAGS:=-std=c99 -O3 -finline-functions #CFLAGS:=-pg -std=c99 -O0 #CFLAGS:=-std=c99 -O0 -g +export BOOT +ifneq ($(BOOT),) +CFLAGS+=-DBOOT=1 +endif + include .config.make -include .local.make include make/install.make @@ -47,7 +52,7 @@ mes.h: mes.c GNUmakefile echo "scm $$builtin = {FUNCTION$$args, .name=\"$$scm_name\", .function$$args=&$$name};";\ echo "a = add_environment (a, \"$$scm_name\", &$$builtin);" 1>&2;\ done; echo '#endif'; echo '#endif' 1>&2) > $@ 2>environment.i - grep -oE '^scm ([a-z_]+) = {(SCM|SYMBOL),' mes.c | cut -d' ' -f 2 |\ + grep -oE '^scm ([a-z_0-9]+) = {(SCM|SYMBOL),' mes.c | cut -d' ' -f 2 |\ while read f; do\ echo "symbols = cons (&$$f, symbols);";\ done > symbols.i @@ -74,7 +79,7 @@ mes-check: all guile-check: for i in $(TESTS); do\ - guile -s <(cat $(MES-0) $$(scripts/include.mes $$i | grep -Ev 'let.mes|quasiquote.mes|base-0|srfi-0') $$i);\ + guile -s <(cat $(MES-0) $$(scripts/include.mes $$i | grep -Ev 'let.mes|quasiquote.mes|base-0|loop-0|srfi-0') $$i);\ done for i in $(TESTS); do\ guile -s <(cat $(MES-0) module/mes/test.mes $$i);\ diff --git a/mes.c b/mes.c index 48af78ef..ca0bb435 100644 --- a/mes.c +++ b/mes.c @@ -28,7 +28,6 @@ #include #include -#define BOOT 0 #define DEBUG 0 #define BUILTIN_QUASIQUOTE 1 // 6x speedup for mescc #define MES_FULL 1 diff --git a/scripts/include.mes b/scripts/include.mes index c13e2e35..3638d04b 100755 --- a/scripts/include.mes +++ b/scripts/include.mes @@ -9,6 +9,10 @@ for prefix in $(dirname $(dirname $0))/share/mes . $(dirname $(dirname $0)); do break; fi done + +if [ -n "$BOOT" ]; then + echo $prefix/module/mes/loop-0.mes +fi cat $1 \ | grep -Eo '(mes-use-module \([^()]+ [^()]+))' \ | grep -Eo ' \([^)]+\)' \