-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 884 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (34 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Compile *.lisp in the current directory.
PROGRAMS := $(basename $(wildcard *.lisp))
.PHONY: test clean
# build the compiler
slisp: main.go
go build .
# clean everything
clean:
rm -f slisp $(PROGRAMS) *.asm *.o
cd test && make clean
cd examples && make clean
#
# "make all" will compile all the *.lisp programs in the current
# directory; this is useful because I often have scratch programs
# present when experimenting.
#
all: $(PROGRAMS)
# Optionally remove unused sections and strip the binaries.
ifeq ($(SMALL),1)
LINK_CMD = @ld --gc-sections -s -o $@ $@.o
else
LINK_CMD = @ld -o $@ $@.o
endif
# generic rule to build a binary from a .lisp file
%: %.lisp slisp
@echo "compiling $@"
@./slisp $< > $@.asm
@nasm -f elf64 $@.asm
$(LINK_CMD)
# Run functional tests
test:
cd examples/ && make test
cd examples/bf/ && make test
cd test/ && make test