-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
69 lines (54 loc) · 1.54 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
# Compiler and flags
CC = gcc
CFLAGS = -Wall -lmenu -lncurses -I$(IDIR) -g
VFLAGS = --leak-check=full --show-leak-kinds=all
TFLAGS = -lcriterion --coverage -g -O0
# Directories
IDIR = ./include/
SRCDIR = ./src/
TESTDIR = ./test/
# Source and test files
SOURCES = $(wildcard ${SRCDIR}action/*.c) \
$(wildcard ${SRCDIR}core/*.c) \
$(wildcard ${SRCDIR}entities/*.c) \
$(wildcard ${SRCDIR}map/*.c) \
$(wildcard ${SRCDIR}stats/*.c) \
$(wildcard ${SRCDIR}utils/*.c)
TESTS = $(filter-out ${SRCDIR}core/main.c, \
$(SOURCES) \
$(wildcard ${TESTDIR}action/*.c) \
$(wildcard ${TESTDIR}entities/*.c) \
$(wildcard ${TESTDIR}stats/*.c) \
$(wildcard ${TESTDIR}utils/*.c))
# Targets
.PHONY: all memory fullmemory test coverage allclean clean cleantest cleancoverage
.SILENT: all memory fullmemory test coverage allclean
# Main targets
all: clean castaway run clean
memory: clean castaway simplecheck clean
fullmemory: clean castaway fullcheck clean
test: clean criterion cleantest
coverage: clean cleancoverage criterion gcovr clean
allclean: clean cleancoverage cleantest
debug: clean castaway gdb clean
# Rules
castaway:
$(CC) $(SOURCES) $(CFLAGS) -o $@
simplecheck:
valgrind ./castaway
fullcheck:
valgrind $(VFLAGS) ./castaway
criterion:
$(CC) $(TESTS) $(CFLAGS) $(TFLAGS) && ./a.out
gcovr:
gcovr --html-details -o ./test/coverage/coverage.html
gdb:
gdb ./castaway
run:
./castaway
cleancoverage:
rm -f ./test/coverage/*
cleantest:
rm -f ./a.out ./*.gcda ./*.gcno
clean:
rm -f castaway