-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmakefile
More file actions
157 lines (125 loc) · 3.13 KB
/
makefile
File metadata and controls
157 lines (125 loc) · 3.13 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.POSIX:
.DELETE_ON_ERROR:
USE_WIRINGPI ?= 0
USE_GPIO ?= 0
USE_FLTO ?= 0
USE_GDB ?= 0
CC := gcc
LIBS := -lm -ldl -lpthread -lncurses
INCS :=
CURSES_CFLAGS := $(shell ncursesw6-config --cflags)
CURSES_LIBS := $(shell ncursesw6-config --libs)
CFLAGS += $(INCS) -Wall $(CURSES_CFLAGS)
# Files in library/ that need to be compiled
SRC_LISP := library/bit.lsp \
library/escape.lsp \
library/i18n.lsp \
library/logger.lsp \
library/ndbm.lsp \
library/opengl.lsp \
library/regex.lsp \
library/tcltk.lsp \
library/virtty.lsp \
library/datetime.lsp \
library/plot.lsp \
library/unistd.lsp
CFLAGS += -O3
ifeq ($(USE_FLTO),1)
CFLAGS += -O3 -flto
endif
ifeq ($(USE_GDB),1)
CFLAGS += -O0 -g
endif
ifeq ($(shell uname -n),raspberrypi)
CFLAGS += -O3
endif
OBJ_LISP := $(SRC_LISP:.lsp=.o)
ifeq ($(shell uname -n),raspberrypi)
CFLAGS += -D__rpi__
endif
ifeq ($(shell uname -n),raspberrypi)
ifeq ($(USE_WIRINGPI),1)
CFLAGS += -D__rpiwiring__
LIBS += -lwiringPi
endif
endif
ifeq ($(shell uname -n),raspberrypi)
ifeq ($(USE_GPIO),1)
CFLAGS += -D__rpigpio__
LIBS += -lgpiod
endif
endif
PREFIX := /usr/local
SHAREDIR ?= $(PREFIX)/share/eisl
CFLAGS += -DSHAREDIR=$(SHAREDIR)
bindir := $(PREFIX)/bin
sharedir := $(PREFIX)/share/eisl/library
DESTDIR :=
INSTALL := install
INSTALL_PROGRAM := $(INSTALL) -m755
MKDIR_PROGRAM := mkdir -p -m 755
# Use files from source tree at compile time because
# sharedir isn't populated yet
EASY_ISLISP := $(CURDIR)
export EASY_ISLISP
EISL_OBJS := main.o \
function.o \
extension.o \
syntax.o \
data.o \
gbc.o \
cell.o \
error.o \
bignum.o \
compute.o \
edit.o \
syn_highlight.o \
link.o \
parallel.o
TARGETS := eisl edlis
all: $(TARGETS)
eisl: $(EISL_OBJS)
$(CC) $(CFLAGS) $^ -o $@ $(LIBS)
%.o: %.c eisl.h ffi.h term.h
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.lsp eisl
echo '(load "library/compiler.lsp") (compile-file "$<")' | ./eisl -r
touch $@
main.o: function.o extension.o syntax.o data.o gbc.o cell.o error.o bignum.o compute.o edit.o syn_highlight.o link.o parallel.o
function.o: function.c eisl.h
extension.o: extension.c eisl.h
syntax.o: syntax.c eisl.h
data.o: data.c eisl.h
gbc.o: gbc.c eisl.h
cell.o: cell.c eisl.h
error.o: error.c eisl.h
bignum.o: bignum.c eisl.h
compute.o: compute.c eisl.h
edit.o: edit.c eisl.h
syntax_highlight.o: syntax_highlight.c eisl.h
link.o: link.c eisl.h
parallel.o: parallel.c eisl.h
edlis: edlis.o syn_highlight.o
$(CC) $(CFLAGS) $^ -o $@ $(CURSES_LIBS)
edlis.o: edlis.c edlis.h term.h
$(CC) $(CFLAGS) -c edlis.c
.PHONY: install
install: eisl edlis
$(MKDIR_PROGRAM) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) eisl $(DESTDIR)$(bindir)/eisl
$(INSTALL_PROGRAM) edlis $(DESTDIR)$(bindir)/edlis
$(MKDIR_PROGRAM) $(DESTDIR)$(sharedir)
$(INSTALL_PROGRAM) library/* $(DESTDIR)$(sharedir)
$(INSTALL_PROGRAM) fast.h ffi.h $(DESTDIR)/$(PREFIX)/share/eisl
.PHONY: lisp
lisp: $(OBJ_LISP)
.PHONY: uninstall
uninstall:
$(RM) $(DESTDIR)$(bindir)/eisl
$(RM) $(DESTDIR)$(bindir)/edlis
.PHONY: clean
clean:
$(RM) *.o $(OBJ_CII) $(OBJ_LISP) eisl edlis
.PHONY: check
check:
cppcheck --enable=warning,performance,portability --std=c17 --library=posix -j4 .