-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
103 lines (74 loc) · 2.7 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
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
CC = gcc
INCLUDES = -I./src/include
CFLAGS = -g $(INCLUDES)
MEMTEST = echo "\n$@\n" >>memlog && valgrind --leak-check=full --error-exitcode=123 --log-fd=9 9>>memlog
REPORT = (echo $?; cat memlog)
.PHONY: report clear_memlog clean test dist/tests/*
.SILENT:
all: preamble dist/lib/libasync.a
install: all
cp -r src/include/async/ /usr/local/include/async/
cp dist/lib/libasync.a /usr/local/lib/libasync.a
ldconfig
preamble:
mkdir -p dist/tests
mkdir -p dist/lib
test: clear_memlog dist/tests/rc dist/tests/closures dist/tests/structures dist/tests/events dist/tests/emitter dist/tests/generators dist/tests/await
echo
echo ALL TESTS AND MEMORY CHECKS PASSED!
echo
clear_memlog:
echo > memlog
dist/tests/rc: src/tests/rc.c dist/lib/libasync.a
$(CC) -o $@ $^ $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/tests/regions: src/tests/regions.c dist/lib/libasync.a
$(CC) -o $@ $^ $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/tests/await: src/tests/await.c dist/lib/libasync.a
$(CC) -o $@ $^ -pthread $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/tests/closures: src/tests/closures.c dist/lib/libasync.a
$(CC) -o $@ $^ $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/tests/emitter: src/tests/eventemitter.c dist/lib/libasync.a
$(CC) -o $@ $^ $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/tests/events: src/tests/events.c dist/lib/libasync.a
$(CC) -o $@ $^ -pthread -lrt $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/tests/generators: src/tests/generators.c dist/lib/libasync.a
$(CC) -o $@ $^ $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/tests/structures: src/tests/structures.c dist/lib/libasync.a
$(CC) -o $@ $^ $(CFLAGS)
$(MEMTEST) ./$@ || $(REPORT)
dist/lib/Array.o: src/lib/Array.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/region.o: src/lib/region.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/closure.o: src/lib/closure.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/Emitter.o: src/lib/Emitter.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/Events.o: src/lib/Events.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/Generator.o: src/lib/Generator.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/HashMap.o: src/lib/HashMap.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/Promise.o: src/lib/Promise.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/StringSet.o: src/lib/StringSet.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/Task.o: src/lib/Task.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/partial.o: src/lib/Partial.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/rc.o: src/lib/rc.c
$(CC) -c -o $@ $^ $(CFLAGS)
dist/lib/libasync.a: dist/lib/rc.o dist/lib/region.o dist/lib/Array.o dist/lib/Emitter.o dist/lib/Events.o dist/lib/Generator.o dist/lib/HashMap.o dist/lib/Promise.o dist/lib/StringSet.o dist/lib/Task.o dist/lib/partial.o dist/lib/closure.o
ar -rc $@ $^
clean:
rm dist/tests/*
rm dist/lib/*