blob: 17ee1ffbec2cd5d6e8cd18c0f3123e8e36a691ee [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 \
swissChilib3ca4fb2021-04-20 10:33:00 -070018 compiler.o \
19 lib/std.o
swissChilica107a02021-04-14 12:07:30 -070020
swissChili8cfb7c42021-04-18 21:17:58 -070021ifeq ($(PLAT),linux)
22OBJECTS += plat/linux.o
23else
24$(error linux is the only supported option for PLAT)
25endif
26
swissChilica107a02021-04-14 12:07:30 -070027LUA = vendor/luajit/src/host/minilua
28
29vendor/luajit/src/host/minilua: vendor/luajit/src/host/minilua.c
30 status_log(CC, $<)
31 @$(CC) $< -o $@ -lm
32
33compiler.c: compiler.dasc
34 status_log(DYNASM, $<)
35 @$(LUA) vendor/luajit/dynasm/dynasm.lua -o $@ $<
swissChili7a6f5eb2021-04-13 16:46:02 -070036
37type(executable)
38
39run: lisp
40 status_log(RUN, ./lisp)
swissChilibed80922021-04-13 21:58:05 -070041 @./lisp "$$(cat test.lisp)"
42
43format:
44 status_log(FORMAT, *)
swissChilica107a02021-04-14 12:07:30 -070045 @clang-format -i *.c *.h *.dasc
swissChili7a6f5eb2021-04-13 16:46:02 -070046
47finish