forked from McFrappe/TTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
65 lines (46 loc) · 1.35 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
CC=gcc
CFLAGS=-Wall -pedantic -g
CFLAGS_LIB=-c
LIBS=$(shell pkg-config --libs --cflags libcurl ncurses)
TEST_LIBS=$(shell pkg-config --libs cunit)
BASE_OBJ_FILES:=src/parser.o src/html_parser.c src/pages.o src/errors.c
OBJ_FILES:=src/ui.o src/api.o src/draw.c src/colors.c $(BASE_OBJ_FILES)
MAIN_FILES:=src/main.c $(OBJ_FILES)
TEST_FILES:=test/unittests.c $(BASE_OBJ_FILES)
PREFIX=/usr/local
DIST_DIR=bin
TTT_OUT_PATH=$(DIST_DIR)/ttt
TEST_OUT_PATH=$(DIST_DIR)/ttt_tests
VALGRIND_FLAGS=--leak-check=full \
--show-leak-kinds=all \
--suppressions=static/valgrind.supp \
--error-exitcode=1 \
--track-origins=yes
%.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_LIB) $(LIBS) $^ -o $@
main: prebuild $(MAIN_FILES)
$(CC) $(CFLAGS) $(MAIN_FILES) -o $(TTT_OUT_PATH) $(LIBS)
unittests: prebuild $(TEST_FILES)
$(CC) $(CFLAGS) $(TEST_FILES) -o $(TEST_OUT_PATH) $(TEST_LIBS)
run: main
./$(TTT_OUT_PATH)
runr: main
./$(TTT_OUT_PATH) -r
memrun: main
valgrind $(VALGRIND_FLAGS) ./$(TTT_OUT_PATH)
memrunr: main
valgrind $(VALGRIND_FLAGS) ./$(TTT_OUT_PATH) -r
test: unittests
./$(TEST_OUT_PATH)
memtest: unittests
valgrind $(VALGRIND_FLAGS) ./$(TEST_OUT_PATH)
install: main
mkdir -p $(PREFIX)/bin
install -m 0755 $(TTT_OUT_PATH) $(PREFIX)/bin/ttt
uninstall:
rm $(PREFIX)/bin/ttt
prebuild:
mkdir -p $(DIST_DIR)
clean:
rm -f src/*.o
rm -rf ./$(DIST_DIR)