swissChili | 8cfb7c4 | 2021-04-18 21:17:58 -0700 | [diff] [blame] | 1 | # -*- mode:makefile -*- |
| 2 | |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 3 | init(lisp, lisp) |
| 4 | |
swissChili | 8cfb7c4 | 2021-04-18 21:17:58 -0700 | [diff] [blame] | 5 | option(PLAT, "`platform to build for: either linux or bluejay'", linux) |
| 6 | |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 7 | preset(optimize) |
| 8 | preset(32) |
| 9 | preset(debug) |
| 10 | preset(warn) |
| 11 | |
| 12 | archetype(c) |
| 13 | |
swissChili | ca107a0 | 2021-04-14 12:07:30 -0700 | [diff] [blame] | 14 | CFLAGS += -Ivendor/luajit/dynasm |
| 15 | |
| 16 | OBJECTS = main.o \ |
| 17 | lisp.o \ |
swissChili | b3ca4fb | 2021-04-20 10:33:00 -0700 | [diff] [blame] | 18 | compiler.o \ |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame^] | 19 | lib/std.o \ |
| 20 | plat/linux.o |
swissChili | 8cfb7c4 | 2021-04-18 21:17:58 -0700 | [diff] [blame] | 21 | |
swissChili | ca107a0 | 2021-04-14 12:07:30 -0700 | [diff] [blame] | 22 | LUA = vendor/luajit/src/host/minilua |
| 23 | |
| 24 | vendor/luajit/src/host/minilua: vendor/luajit/src/host/minilua.c |
| 25 | status_log(CC, $<) |
| 26 | @$(CC) $< -o $@ -lm |
| 27 | |
| 28 | compiler.c: compiler.dasc |
| 29 | status_log(DYNASM, $<) |
| 30 | @$(LUA) vendor/luajit/dynasm/dynasm.lua -o $@ $< |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 31 | |
| 32 | type(executable) |
| 33 | |
| 34 | run: lisp |
| 35 | status_log(RUN, ./lisp) |
swissChili | bed8092 | 2021-04-13 21:58:05 -0700 | [diff] [blame] | 36 | @./lisp "$$(cat test.lisp)" |
| 37 | |
| 38 | format: |
| 39 | status_log(FORMAT, *) |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame^] | 40 | @clang-format -i *.c *.h *.dasc plat/* lib/* |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 41 | |
| 42 | finish |