-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (40 loc) · 1.28 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
CC=gcc
DIRECTORY=pwd
CFLAGS=-std=c11 -Wall -Werror -Wextra
TC_FLAGS=
LEAK_CHECK=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CC += -D LINUX -g
TC_FLAGS += -lcheck -lsubunit -lm -lrt -lpthread
LEAK_CHECK +=CK_FORK=no valgrind --trace-children=yes --track-fds=yes --leak-check=yes --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind_log.txt ./test.out
endif
ifeq ($(UNAME_S),Darwin)
CC += -D OSX
TC_FLAGS += $(shell pkg-config --cflags check) $(shell pkg-config --libs check)
LEAK_CHECK +=CK_FORK=no leaks -atExit -- ./test.out
endif
#-wall лучше снять перед вертером
FLAG1=-I src
FLAG2=-c
default: all
all: clean s21_string.a test
test: s21_string.a
$(CC) test.c s21_string.a -o test.out $(TC_FLAGS)
./test.out
s21_string.a: s21_string.o
ar rcs s21_string.a s21_string.o
ranlib s21_string.a
s21_string.o: s21_string.c
$(CC) $(FLAG1) $(CFLAGS) $(FLAG2) s21_string.c -o s21_string.o
clean:
rm -rf *.a *.o *.out *.txt *.info *.gcno *.gcda report
check:
cppcheck --enable=all --suppress=missingIncludeSystem *.h *.c
python3 cpplint.py --extension=c *.c *.h
$(LEAK_CHECK)
gcov_report:
$(CC) --coverage test.c s21_string.c -o test.out $(TC_FLAGS)
./test.out
lcov -t "test.out" -o test.info -c -d .
genhtml -o report test.info