blob: 3f50e8563cea6f96dc51cad22286502f4b402ec0 [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
swissChili15f1cae2021-07-05 19:08:47 -070016CFLAGS += -Ivendor/luajit/dynasm -Werror
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
swissChilif68671f2021-07-05 14:14:44 -070041lisp_libpath = $(ROOT)/lib/lisp
swissChili2999dd12021-07-02 14:19:53 -070042
swissChili7a6f5eb2021-04-13 16:46:02 -070043run: lisp
swissChili2999dd12021-07-02 14:19:53 -070044 status_log(LISP, $(F))
swissChilif68671f2021-07-05 14:14:44 -070045 @LISP_LIBRARY_PATH="$(lisp_libpath)" ./lisp $(F)
swissChilibed80922021-04-13 21:58:05 -070046
swissChili708d4c42021-07-04 17:40:07 -070047leak-check: lisp
48 status_log(VALGRIND, lisp $(F))
swissChilif68671f2021-07-05 14:14:44 -070049 @LISP_LIBRARY_PATH="$(lisp_libpath)" valgrind --leak-check=full ./lisp $(F)
swissChili708d4c42021-07-04 17:40:07 -070050
swissChilibed80922021-04-13 21:58:05 -070051format:
52 status_log(FORMAT, *)
swissChili53472e82021-05-08 16:06:32 -070053 @clang-format -i *.c *.h *.dasc plat/* lib/*
swissChili7a6f5eb2021-04-13 16:46:02 -070054
55finish