swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 1 | # -*- mode:tcl -*- |
| 2 | |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 3 | init lisp |
| 4 | |
swissChili | 56cf817 | 2022-07-30 18:47:48 -0700 | [diff] [blame] | 5 | presets 32 debug warn nasm |
| 6 | cflags -Ivendor/luajit/dynasm -O0 |
| 7 | asmflags -felf32 |
| 8 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 9 | # Make this `readline', `edit', or `none' |
| 10 | option READLINE readline |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 11 | |
| 12 | set lisp_libpath "$::root/lib/lisp" |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 13 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 14 | if {$options(READLINE) == "none"} { |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 15 | cflags -DNO_READLINE |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 16 | } else { |
| 17 | cflags -L/usr/lib/i386-linux-gnu -l$options(READLINE) |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 18 | } |
| 19 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 20 | set lua [pwd]/vendor/luajit/src/host/minilua |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 21 | |
| 22 | rule $lua ${lua}.c { |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 23 | log CC $::src |
| 24 | cc "$::src -o $::target -lm" |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 25 | } |
| 26 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 27 | rule [pwd]/compiler.c "[pwd]/compiler.dasc $lua" { |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 28 | log DYNASM $::first_src |
| 29 | shell "$::lua vendor/luajit/dynasm/dynasm.lua -o $::target $::first_src" |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 30 | } |
| 31 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 32 | rule repl [pwd]/lisp { |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 33 | log LISP repl |
| 34 | shell "LISP_LIBRARY_PATH=$::lisp_libpath ./lisp $::root/lib/lisp/repl/repl.lisp" |
| 35 | } |
| 36 | |
swissChili | c0acce4 | 2022-07-31 13:38:17 -0700 | [diff] [blame] | 37 | rule valgrind [pwd]/lisp { |
| 38 | log VALGRIND "lisp test-gc.lisp" |
swissChili | 9d428a8 | 2022-08-01 20:47:40 -0700 | [diff] [blame] | 39 | shell "LISP_LIBRARY_PATH=$::lisp_libpath valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all ./lisp quicksort.lisp" |
swissChili | c0acce4 | 2022-07-31 13:38:17 -0700 | [diff] [blame] | 40 | } |
| 41 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 42 | srcs main.c lisp.c compiler.c lib/std.c plat/linux.c istream.c gc.c \ |
swissChili | 8b5ec7a | 2022-08-05 22:26:17 -0700 | [diff] [blame] | 43 | call_list.s error.c lib/classes.c |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 44 | |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 45 | type executable |