-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (28 loc) · 1.12 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
CC:=gcc
FLAGS:= -std=c17 -O0 -Wall -Wextra -Wpedantic -Wformat=2 -Wno-unused-parameter -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
-Wredundant-decls -Wnested-externs -Wmissing-include-dirs -g -rdynamic\
STATIC_FLAGS:= -std=c17 -static
INCLUDE:= -I./include
SRC:= $(wildcard ./src/main/*.c ./src/journey/*.c ./src/journey/jrn_file/*.c ./src/tests/*.c)
HEADERS:=$(wildcard ./headers/*.h)
TARGET:=./bin/prog
LIBS:= -luuid
SQLITE_INCLUDE:= -I./third_party/sqlite/include
SQLITE_LIB:= -L./third_party/sqlite/lib -lsqlite3
INCLUDE+= $(SQLITE_INCLUDE)
LIBS+= $(SQLITE_LIB)
all:
$(CC) $(SRC) $(FLAGS) $(INCLUDE) $(LIBS) -o $(TARGET) && $(TARGET)
san:
$(CC) $(SRC) $(FLAGS) -fsanitize=address $(INCLUDE) $(LIBS) -o $(TARGET) && $(TARGET)
static:
$(CC) $(SRC) $(STATIC_FLAGS) $(INCLUDE) -o $(TARGET) && $(TARGET)
CPP_CHECK_INCLUDES:= -I./include
CPP_CHECK_DIR:=./cppcheck
check:
mkdir -p $(CPP_CHECK_DIR) && \
cppcheck --enable=all --suppress=missingIncludeSystem \
--cppcheck-build-dir=$(CPP_CHECK_DIR) $(CPP_CHECK_INCLUDES) $(SRC) $(HEADERS) \
val:
valgrind $(TARGET)