forked from ashinn/chibi-scheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkfile
109 lines (81 loc) · 2.9 KB
/
mkfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
</$objtype/mkfile
BIN=/$objtype/bin
TARG=chibi-scheme
MODDIR=/sys/lib/chibi-scheme
CHIBI=./$O.out
GENSTATIC=./tools/chibi-genstatic
CPPFLAGS= -Iinclude -DPLAN9 -DSEXP_USE_GREEN_THREADS=0 -D__$objtype
CFLAGS= -p $CPPFLAGS
CFLAGS_STATIC=$CFLAGS -DSEXP_USE_STATIC_LIBS
OFILES=gc.$O sexp.$O bignum.$O opcodes.$O plan9.$O vm.$O simplify.$O eval.$O main.$O $STATIC
HFILES=include/chibi/sexp.h include/chibi/eval.h include/chibi/features.h include/chibi/install.h
CLEANFILES=tests/basic/*.out tests/basic/*.err
EXCLUDE=srfi.18 srfi.27 chibi.filesystem chibi.io \
chibi.net chibi.process chibi.stty chibi.system \
chibi.time
CHIBI_LIBS = lib/chibi/filesystem.c lib/chibi/process.c \
lib/chibi/time.c lib/chibi/system.c lib/chibi/stty.c \
lib/chibi/weak.c lib/chibi/heap-stats.c lib/chibi/disasm.c \
lib/chibi/net.c
CHIBI_IO_COMPILED_LIBS = lib/chibi/io/io.c
CHIBI_OPT_COMPILED_LIBS = lib/chibi/optimize/rest.c \
lib/chibi/optimize/profile.c
COMPILED_LIBS = $CHIBI_COMPILED_LIBS $CHIBI_IO_COMPILED_LIBS \
$CHIBI_OPT_COMPILED_LIBS \
lib/srfi/33/bit.c lib/srfi/39/param.c \
lib/srfi/69/hash.c lib/srfi/95/qsort.c lib/srfi/98/env.c \
lib/scheme/time.c
</sys/src/cmd/mkone
clean:
rm -f $CLEANFILES *.[$OS] [$OS].out
clibs.$O: clibs.c
$TARG: $O.out
rm $OFILES
mk 'CFLAGS=$CFLAGS_STATIC' clibs.$O $OFILES
mk 'CFLAGS=$CFLAGS_STATIC' 'STATIC=clibs.$O' default
target: $O.out
mv $O.out $TARG
%.c: %.stub
$CHIBI ./tools/chibi-ffi $stem.stub
include/chibi/install.h: mkfile
echo '#define sexp_default_module_path "'$MODDIR'"' > include/chibi/install.h
echo '#define sexp_so_extension ".no-such-file"' >> include/chibi/install.h
echo '#define sexp_platform "plan9"' >> include/chibi/install.h
echo '#define sexp_version "'`{cat VERSION}'"' >> include/chibi/install.h
echo '#define sexp_release_name "'`{cat RELEASE}'"' >> include/chibi/install.h
dist-clean: clean
rm -f include/chibi/install.h clibs.c
install:V: $BIN/$TARG
test -d $MODDIR || mkdir -p $MODDIR
{cd lib; tar c .} | {cd $MODDIR ; tar x }
clibs.c:V: $GENSTATIC $CHIBI $COMPILED_LIBS
du -a lib | sed 's/^[0-9]*[ ]*//' | grep '\.sld$' | \
$CHIBI $GENSTATIC \
-x srfi.27 -x srfi.18 -x chibi.filesystem -x chibi.io \
-x chibi.net -x chibi.process -x chibi.stty -x chibi.system \
-x chibi.time \
> ,clibs.c && mv ,clibs.c clibs.c
test:V:
./$O.out -xscheme tests/r5rs-tests.scm
test-threads:
./$O.out -xscheme tests/thread-tests.scm
test-numbers:
./$O.out -xscheme tests/numeric-tests.scm
test-flonums:
./$O.out -xscheme tests/flonum-tests.scm
test-hash:
./$O.out -xscheme tests/hash-tests.scm
test-match:
./$O.out -xscheme tests/match-tests.scm
test-loop:
./$O.out -xscheme tests/loop-tests.scm
test-sort:
./$O.out -xscheme tests/sort-tests.scm
test-records:
./$O.out -xscheme tests/record-tests.scm
test-weak:
./$O.out -xscheme tests/weak-tests.scm
test-unicode:
./$O.out -xscheme tests/unicode-tests.scm
test-libs:
./$O.out -xscheme tests/lib-tests.scm