-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
39 lines (27 loc) · 1.11 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
override CFLAGS += -std=c99 -Wall
SRCDIR = $(CURDIR)
TESTDIR ?= /tmp/path-mapping
TESTTOOLS = $(notdir $(basename $(wildcard $(SRCDIR)/test/testtool-*.c)))
UNIT_TESTS = test-pathmatching
path-mapping.so: path-mapping.c
gcc $(CFLAGS) -shared -fPIC path-mapping.c -o $@ -ldl
path-mapping-debug.so: path-mapping.c
gcc $(CFLAGS) -DDEBUG -shared -fPIC path-mapping.c -o $@ -ldl
path-mapping-quiet.so: path-mapping.c
gcc $(CFLAGS) -DQUIET -shared -fPIC path-mapping.c -o $@ -ldl
all: path-mapping.so path-mapping-debug.so path-mapping-quiet.so
clean:
rm -f *.so
rm -rf $(TESTDIR)
test: all unit_tests testtools
for f in $(UNIT_TESTS); do $(TESTDIR)/$$f; done
TESTDIR="$(TESTDIR)" test/integration-tests.sh
unit_tests: $(addprefix $(TESTDIR)/, $(UNIT_TESTS))
testtools: $(addprefix $(TESTDIR)/, $(TESTTOOLS))
$(TESTDIR)/test-%: $(SRCDIR)/test/test-%.c $(SRCDIR)/path-mapping.c
mkdir -p $(TESTDIR)
cd $(TESTDIR); gcc $(CFLAGS) $< "$(SRCDIR)/path-mapping.c" -ldl -o $@
$(TESTDIR)/testtool-%: $(SRCDIR)/test/testtool-%.c
mkdir -p $(TESTDIR)
cd $(TESTDIR); gcc $(CFLAGS) $^ -o $@
.PHONY: all libs clean test unit_tests testtools