mes/GNUmakefile

95 lines
2.9 KiB
Makefile
Raw Normal View History

.PHONY: all check default
CFLAGS=-std=c99 -O3 -finline-functions
#CFLAGS=-std=c99 -g
default: all
all: mes
2016-07-09 21:12:25 +00:00
mes: mes.c mes.h
mes.h: mes.c GNUmakefile
( echo '#if MES_C'; echo '#if MES_FULL' 1>&2;\
2016-07-11 19:50:59 +00:00
grep -E '^(scm [*])*[a-z0-9_]+ \(.*\)( {|$$)' $< | grep -Ev '\(.*(char |bool |int )' | sed -e 's,^scm [*],,' | sort |\
2016-07-09 21:12:25 +00:00
while read f; do\
fun=$$(echo $$f | sed -e 's,^scm [*],,' -e 's,{.*,,');\
name=$$(echo $$fun | sed -e 's,^scm [\*],,' | grep -o '^[^ ]*');\
2016-07-11 08:38:02 +00:00
scm_name=$$(echo $$name | sed -e 's,_to_,->,' -e 's,_p$$,?,' -e 's,_x$$,!,' -e 's,^builtin_,,' -re 's,(.*)_$$,c:\1,' | sed \
2016-07-10 10:52:53 +00:00
-e 's,^divide$$,/,'\
-e 's,^is?$$,=,'\
2016-07-16 11:24:38 +00:00
-e 's,^greater?$$,>,'\
2016-07-10 10:52:53 +00:00
-e 's,^less?$$,<,'\
-e 's,^minus$$,-,'\
-e 's,^multiply$$,*,'\
-e 's,^plus$$,+,'\
-e 's,_,-,g');\
2016-07-09 21:12:25 +00:00
args=$$(echo $$fun | grep -o 'scm [\*]' | wc -l);\
2016-07-10 20:43:23 +00:00
[ "$$(echo $$fun | fgrep -o ... )" = "..." ] && args=n;\
2016-07-09 21:12:25 +00:00
echo "scm *$$fun;";\
echo "scm scm_$$name = {FUNCTION$$args, .name=\"$$scm_name\", .function$$args=&$$name};";\
echo "a = add_environment (a, \"$$scm_name\", &scm_$$name);" 1>&2;\
done; echo '#endif'; echo '#endif' 1>&2) > $@ 2>environment.i
2016-07-23 13:17:03 +00:00
check: all guile-check
./mes.test
./mes.test ./mes
2016-07-23 12:39:33 +00:00
cat scm.mes lib/srfi/srfi-0.scm test.mes | ./mes
2016-07-23 13:17:03 +00:00
guile-check:
guile -s test.mes
run: all
cat scm.mes test.mes | ./mes
2016-10-18 20:19:57 +00:00
2016-07-23 12:39:33 +00:00
psyntax: all
cat scm.mes psyntax.mes psyntax.pp psyntax2.mes | ./mes
2016-10-18 20:19:57 +00:00
syntax: all
2016-07-23 12:39:33 +00:00
cat scm.mes syntax.mes syntax-test.mes | ./mes
2016-07-23 12:39:33 +00:00
syntax.test: syntax.mes syntax-test.mes
cat $^ > $@
guile-syntax: syntax.test
guile -s $^
syntax-case: all
cat scm.mes syntax.mes syntax-case-lib.mes syntax-case.mes syntax-case-after.mes syntax-case-test.mes | ./mes
syntax-case.test: syntax.mes syntax-case-lib.mes syntax-case.mes syntax-case-after.mes syntax-case-test.mes
cat $^ > $@
guile-syntax-case: syntax-case.test
guile -s $^
macro: all
cat scm.mes macro.mes | ./mes
2016-07-23 12:39:33 +00:00
peg: all
cat scm.mes syntax.mes syntax-case-lib.mes syntax-case.mes syntax-case-after.mes peg.mes peg/codegen.scm peg/string-peg.scm peg/simplify-tree.scm peg/using-parsers.scm peg/cache.scm peg-test.mes | ./mes
2016-07-23 12:39:33 +00:00
peg.test: peg/pmatch.scm peg.mes peg/codegen.scm peg/string-peg.scm peg/simplify-tree.scm peg/using-parsers.scm peg/cache.scm peg-test.mes
cat $^ | sed 's,\(;; Packages the results of a parser\),(when (guile?) (set! compile-peg-pattern (@@ (ice-9 peg codegen) compile-peg-pattern)))\n\1,' > $@
guile-peg: peg.test
# guile -s peg-test.mes
# @echo "======================================="
guile -s $^
clean:
rm -f mes environment.i mes.h peg.test syntax.test
record: all
cat scm.mes syntax.mes lib/record.mes lib/record.scm lib/srfi/srfi-9.scm record.mes |./mes
2016-07-24 10:08:21 +00:00
paren: all
cat scm.mes syntax.mes lib/srfi/srfi-0.scm lib/record.mes lib/record.scm lib/srfi/srfi-9.scm lib/lalr.mes lib/lalr.scm paren.scm | ./mes
# #echo '___P((()))'
paren.test: lib/lalr.scm paren.scm
cat $^ > $@
guile-paren: paren.test
echo '___P((()))' | guile -s $^