blob: d5d3001f0220a91a5129c8ad21fb3807f7926691 [file] [log] [blame]
swissChili8cfb7c42021-04-18 21:17:58 -07001# -*- mode:makefile -*-
2
swissChili7a6f5eb2021-04-13 16:46:02 -07003init(lisp, lisp)
4
swissChili8cfb7c42021-04-18 21:17:58 -07005option(PLAT, "`platform to build for: either linux or bluejay'", linux)
6
swissChili7a6f5eb2021-04-13 16:46:02 -07007preset(optimize)
8preset(32)
9preset(debug)
10preset(warn)
11
12archetype(c)
13
swissChilica107a02021-04-14 12:07:30 -070014CFLAGS += -Ivendor/luajit/dynasm
15
16OBJECTS = main.o \
17 lisp.o \
18 compiler.o
19
swissChili8cfb7c42021-04-18 21:17:58 -070020ifeq ($(PLAT),linux)
21OBJECTS += plat/linux.o
22else
23$(error linux is the only supported option for PLAT)
24endif
25
swissChilica107a02021-04-14 12:07:30 -070026LUA = vendor/luajit/src/host/minilua
27
28vendor/luajit/src/host/minilua: vendor/luajit/src/host/minilua.c
29 status_log(CC, $<)
30 @$(CC) $< -o $@ -lm
31
32compiler.c: compiler.dasc
33 status_log(DYNASM, $<)
34 @$(LUA) vendor/luajit/dynasm/dynasm.lua -o $@ $<
swissChili7a6f5eb2021-04-13 16:46:02 -070035
36type(executable)
37
38run: lisp
39 status_log(RUN, ./lisp)
swissChilibed80922021-04-13 21:58:05 -070040 @./lisp "$$(cat test.lisp)"
41
42format:
43 status_log(FORMAT, *)
swissChilica107a02021-04-14 12:07:30 -070044 @clang-format -i *.c *.h *.dasc
swissChili7a6f5eb2021-04-13 16:46:02 -070045
46finish