blob: 7c1fe8e3475f2cc26c717fee194d41cfdb2a5fe6 [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
swissChili2999dd12021-07-02 14:19:53 -07007# preset(optimize)
swissChili7a6f5eb2021-04-13 16:46:02 -07008preset(32)
9preset(debug)
10preset(warn)
swissChili2999dd12021-07-02 14:19:53 -070011preset(nasm)
swissChili7a6f5eb2021-04-13 16:46:02 -070012
swissChili2999dd12021-07-02 14:19:53 -070013archetype(c)
14archetype(asm)
swissChili7a6f5eb2021-04-13 16:46:02 -070015
swissChilica107a02021-04-14 12:07:30 -070016CFLAGS += -Ivendor/luajit/dynasm
swissChili2999dd12021-07-02 14:19:53 -070017ASMFLAGS += -felf -Fdwarf
swissChilica107a02021-04-14 12:07:30 -070018
19OBJECTS = main.o \
20 lisp.o \
swissChilib3ca4fb2021-04-20 10:33:00 -070021 compiler.o \
swissChili53472e82021-05-08 16:06:32 -070022 lib/std.o \
swissChili923b5362021-05-09 20:31:43 -070023 plat/linux.o \
swissChili6d6525e2021-06-15 21:20:53 -070024 istream.o \
swissChili2999dd12021-07-02 14:19:53 -070025 gc.o \
26 call_list.o
swissChili8cfb7c42021-04-18 21:17:58 -070027
swissChilica107a02021-04-14 12:07:30 -070028LUA = vendor/luajit/src/host/minilua
29
swissChili9e57da42021-06-15 22:22:46 -070030$(LUA): vendor/luajit/src/host/minilua.c
swissChilica107a02021-04-14 12:07:30 -070031 status_log(CC, $<)
32 @$(CC) $< -o $@ -lm
33
swissChili9e57da42021-06-15 22:22:46 -070034compiler.c: compiler.dasc | $(LUA)
swissChilica107a02021-04-14 12:07:30 -070035 status_log(DYNASM, $<)
36 @$(LUA) vendor/luajit/dynasm/dynasm.lua -o $@ $<
swissChili7a6f5eb2021-04-13 16:46:02 -070037
38type(executable)
39
swissChili2999dd12021-07-02 14:19:53 -070040F ?= test.lisp
41
swissChili7a6f5eb2021-04-13 16:46:02 -070042run: lisp
swissChili2999dd12021-07-02 14:19:53 -070043 status_log(LISP, $(F))
44 @./lisp $(F)
swissChilibed80922021-04-13 21:58:05 -070045
swissChili708d4c42021-07-04 17:40:07 -070046leak-check: lisp
47 status_log(VALGRIND, lisp $(F))
48 @valgrind --leak-check=full ./lisp $(F)
49
swissChilibed80922021-04-13 21:58:05 -070050format:
51 status_log(FORMAT, *)
swissChili53472e82021-05-08 16:06:32 -070052 @clang-format -i *.c *.h *.dasc plat/* lib/*
swissChili7a6f5eb2021-04-13 16:46:02 -070053
54finish