-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (31 loc) · 1.17 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
CC=gcc
COMPFLAGS=-Wall -Wpedantic -Winline -Wextra -Wno-long-long
DISTDIR=dist
SRCDIR=src
TESTDIR=tests
all: hashmap
$(CC) $(DISTDIR)/hashmap.o $(TESTDIR)/hashmap_test.c -o ./dist/hmt $(COMPFLAGS) $(CCFLAGS)
$(CC) $(DISTDIR)/hashmap.o $(TESTDIR)/update_test.c -o ./dist/ut $(COMPFLAGS) $(CCFLAGS)
hashmap:
$(CC) -c $(SRCDIR)/hashmap.c -o $(DISTDIR)/hashmap.o $(COMPFLAGS) $(CCFLAGS)
debug: COMPFLAGS += -g
debug: all
release: COMPFLAGS += -O3
release: all
sanitize: COMPFLAGS += -fsanitize=undefined
sanitize: test
test: COMPFLAGS += --coverage
test: hashmap
$(CC) $(DISTDIR)/hashmap.o $(TESTDIR)/testsuite.c $(CCFLAGS) $(COMPFLAGS) -o ./$(DISTDIR)/test -g -lm
runtests:
@ if [ -f "./$(DISTDIR)/test" ]; then ./$(DISTDIR)/test; fi
clean:
if [ -f "./$(DISTDIR)/hashmap.o" ]; then rm -r ./$(DISTDIR)/hashmap.o; fi
if [ -f "./$(DISTDIR)/ut" ]; then rm -r ./$(DISTDIR)/ut; fi
if [ -f "./$(DISTDIR)/hmt" ]; then rm -r ./$(DISTDIR)/hmt; fi
if [ -f "./$(DISTDIR)/test" ]; then rm -rf ./$(DISTDIR)/*.gcno; fi
if [ -f "./$(DISTDIR)/test" ]; then rm -rf ./$(DISTDIR)/*.gcda; fi
if [ -f "./$(DISTDIR)/test" ]; then rm -r ./$(DISTDIR)/test; fi
rm -f ./*.gcno
rm -f ./*.gcda
rm -f ./*.gcov