| # -*- mode:makefile -*- |
| |
| init(lisp, lisp) |
| |
| option(PLAT, "`platform to build for: either linux or bluejay'", linux) |
| |
| preset(optimize) |
| preset(32) |
| preset(debug) |
| preset(warn) |
| |
| archetype(c) |
| |
| CFLAGS += -Ivendor/luajit/dynasm |
| |
| OBJECTS = main.o \ |
| lisp.o \ |
| compiler.o |
| |
| ifeq ($(PLAT),linux) |
| OBJECTS += plat/linux.o |
| else |
| $(error linux is the only supported option for PLAT) |
| endif |
| |
| LUA = vendor/luajit/src/host/minilua |
| |
| vendor/luajit/src/host/minilua: vendor/luajit/src/host/minilua.c |
| status_log(CC, $<) |
| @$(CC) $< -o $@ -lm |
| |
| compiler.c: compiler.dasc |
| status_log(DYNASM, $<) |
| @$(LUA) vendor/luajit/dynasm/dynasm.lua -o $@ $< |
| |
| type(executable) |
| |
| run: lisp |
| status_log(RUN, ./lisp) |
| @./lisp "$$(cat test.lisp)" |
| |
| format: |
| status_log(FORMAT, *) |
| @clang-format -i *.c *.h *.dasc |
| |
| finish |