-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile
66 lines (53 loc) · 1.14 KB
/
makefile
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
CC = gcc
LIBS = -lm -ldl -pthread
LIBSRASPI = -lm -ldl -lwiringPi -pthread
INCS =
CFLAGS = $(INCS) -Wall -O3
LDFLAGS :=
DESTDIR :=
PREFIX := /usr/local
BINDIR := /bin
DEST = $(DESTDIR)$(PREFIX)$(BINDIR)
CURSES_CFLAGS := $(shell ncursesw6-config --cflags)
CURSES_LIBS := $(shell ncursesw6-config --libs)
NPL = npl
EDLOG = edlog
NPL_OBJS = main.o \
parser.o \
function.o \
builtin.o \
extension.o \
link.o \
data.o \
gbc.o \
cell.o \
error.o \
bignum.o \
compute.o \
edit.o \
syntax_highlight.o
EDLOG_OBJS = edlog.o syntax_highlight.o
ifeq ($(shell uname -n),raspberrypi)
all: $(NPL_OBJS) $(NPL)
$(NPL): $(NPL_OBJS)
$(CC) $(NPL_OBJS) -o $(NPL) $(LIBSRASPI)
else
all: $(NPL_OBJS) $(NPL) $(EDLOG)
$(NPL): $(NPL_OBJS)
$(CC) $(NPL_OBJS) -o $(NPL) $(LIBS) $(LDFLAGS)
endif
$(EDLOG): $(EDLOG_OBJS)
$(CC) $(LDFLAGS) $^ -o $@ $(CURSES_LIBS)
edlog.o: edlog.c edlog.h term.h
$(CC) $(CFLAGS) -c edlog.c
install: $(NPL) $(EDLOG)
mkdir -p $(DEST)
install -s $(NPL) $(DEST)
install -s $(EDLOG) $(DEST)
uninstall:
rm -f $(DEST)/npl $(DEST)/edlog
%.o: %.c npl.h
$(CC) -c $< -o $@ $(CFLAGS)
.PHONY: clean all
clean:
rm -f *.o $(NPL) $(EDLOG)