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 | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 7 | # preset(optimize) |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 8 | preset(32) |
9 | preset(debug) | ||||
10 | preset(warn) | ||||
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 11 | preset(nasm) |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 12 | |
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 13 | archetype(c) |
14 | archetype(asm) | ||||
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 15 | |
swissChili | ca107a0 | 2021-04-14 12:07:30 -0700 | [diff] [blame] | 16 | CFLAGS += -Ivendor/luajit/dynasm |
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 17 | ASMFLAGS += -felf -Fdwarf |
swissChili | ca107a0 | 2021-04-14 12:07:30 -0700 | [diff] [blame] | 18 | |
19 | OBJECTS = main.o \ | ||||
20 | lisp.o \ | ||||
swissChili | b3ca4fb | 2021-04-20 10:33:00 -0700 | [diff] [blame] | 21 | compiler.o \ |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame] | 22 | lib/std.o \ |
swissChili | 923b536 | 2021-05-09 20:31:43 -0700 | [diff] [blame] | 23 | plat/linux.o \ |
swissChili | 6d6525e | 2021-06-15 21:20:53 -0700 | [diff] [blame] | 24 | istream.o \ |
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 25 | gc.o \ |
26 | call_list.o | ||||
swissChili | 8cfb7c4 | 2021-04-18 21:17:58 -0700 | [diff] [blame] | 27 | |
swissChili | ca107a0 | 2021-04-14 12:07:30 -0700 | [diff] [blame] | 28 | LUA = vendor/luajit/src/host/minilua |
29 | |||||
swissChili | 9e57da4 | 2021-06-15 22:22:46 -0700 | [diff] [blame] | 30 | $(LUA): vendor/luajit/src/host/minilua.c |
swissChili | ca107a0 | 2021-04-14 12:07:30 -0700 | [diff] [blame] | 31 | status_log(CC, $<) |
32 | @$(CC) $< -o $@ -lm | ||||
33 | |||||
swissChili | 9e57da4 | 2021-06-15 22:22:46 -0700 | [diff] [blame] | 34 | compiler.c: compiler.dasc | $(LUA) |
swissChili | ca107a0 | 2021-04-14 12:07:30 -0700 | [diff] [blame] | 35 | status_log(DYNASM, $<) |
36 | @$(LUA) vendor/luajit/dynasm/dynasm.lua -o $@ $< | ||||
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 37 | |
38 | type(executable) | ||||
39 | |||||
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 40 | F ?= test.lisp |
41 | |||||
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 42 | run: lisp |
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 43 | status_log(LISP, $(F)) |
44 | @./lisp $(F) | ||||
swissChili | bed8092 | 2021-04-13 21:58:05 -0700 | [diff] [blame] | 45 | |
swissChili | 708d4c4 | 2021-07-04 17:40:07 -0700 | [diff] [blame^] | 46 | leak-check: lisp |
47 | status_log(VALGRIND, lisp $(F)) | ||||
48 | @valgrind --leak-check=full ./lisp $(F) | ||||
49 | |||||
swissChili | bed8092 | 2021-04-13 21:58:05 -0700 | [diff] [blame] | 50 | format: |
51 | status_log(FORMAT, *) | ||||
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame] | 52 | @clang-format -i *.c *.h *.dasc plat/* lib/* |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 53 | |
54 | finish |