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 | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 5 | # Make this `readline', `edit', or `none' |
| 6 | option READLINE readline |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 7 | |
| 8 | set lisp_libpath "$::root/lib/lisp" |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 9 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 10 | if {$options(READLINE) == "none"} { |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 11 | cflags -DNO_READLINE |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 12 | } else { |
| 13 | cflags -L/usr/lib/i386-linux-gnu -l$options(READLINE) |
swissChili | 0fc3f26 | 2021-08-09 22:05:17 -0700 | [diff] [blame] | 14 | } |
| 15 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 16 | presets 32 debug warn nasm |
| 17 | cflags -Ivendor/luajit/dynasm -O0 |
| 18 | asmflags -felf32 |
| 19 | |
| 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 | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 37 | srcs main.c lisp.c compiler.c lib/std.c plat/linux.c istream.c gc.c \ |
| 38 | call_list.s error.c |
| 39 | |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 40 | type executable |