-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
67 lines (57 loc) · 1.16 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
65
66
67
cc = cc
ifeq ($(STATIC), true)
static_ldflags = \
-static \
-lxcb \
-lXau \
-lXdmcp
endif
ifeq ($(TSAN), true)
tsan_ldflags = -fsanitize=thread
tsan_cflags= -fsanitize=thread
endif
ldflags = \
-L/usr/local/lib \
-lm \
-lX11 \
-pthread \
$(static_ldflags) \
$(tsan_ldflags) \
$(LDFLAGS)
cflags = \
-g \
-O3 \
-std=c11 \
-I/usr/local/include \
-Wall \
-Wwrite-strings \
-Wextra \
-Werror \
-Wpedantic \
-D_POSIX_C_SOURCE=200809L \
-D_TIME_BITS=64 \
-D_FILE_OFFSET_BITS=64 \
$(tsan_cflags) \
$(CFLAGS)
src = $(shell find src -name '*.c')
headers = $(shell find src -name '*.h')
lib = $(patsubst src/%, lib/%, $(patsubst %.c, %.o, $(src)))
app = inet-lisp-st
bin = bin/$(app)
.PHONY: all run test-modules test-self run-examples test clean
all: bin/$(app)
run: bin/$(app)
./bin/$(app)
test-modules: bin/$(app)
./bin/$(app) test-modules
test-self: bin/$(app)
./bin/$(app) test-self
run-examples: bin/$(app)
bash run-examples.sh
test: test-modules test-self run-examples
bin/$(app): $(lib) lib/$(app).o
mkdir -p $(dir $@); $(cc) $^ $(ldflags) -o $@
lib/%.o: src/%.c $(headers)
mkdir -p $(dir $@); $(cc) -c $(cflags) $< -o $@
clean:
rm -rf lib bin