-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·36 lines (28 loc) · 1.16 KB
/
Copy pathMakefile
File metadata and controls
executable file
·36 lines (28 loc) · 1.16 KB
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
CC = gcc -Wall -Werror -Wextra -std=c11
CHECK_FLAGS = $(shell pkg-config --cflags --libs check)
COVERAGE=-fprofile-arcs -ftest-coverage
all: clean s21_string.a test gcov_report
s21_string.a: s21_string.c s21_string.h
$(CC) $(COVERAGE) -c s21_string.c
ar rcs s21_string.a s21_string.o
rm -rf s21_string.o
test: s21_string.a s21_string_tests.c s21_string_tests.h test_*.c
$(CC) $(COVERAGE) -c s21_string_tests.c test_*.c
$(CC) $(COVERAGE) -o s21_string_tests s21_string_tests.o test_*.o -L. s21_string.a $(CHECK_FLAGS)
rm -rf s21_string_tests.o test_*.o
./s21_string_tests; sleep 1
gcov_report: test
gcov s21_string_tests.gcda
gcovr --html-details -o report.html
rm -rf *.gcno *.gcov *.gcda
clean:
rm -rf *.o *.a *.html *.css *.gcno *.gcov *.gcda *.log
rm -rf s21_string_tests
format:
clang-format -i --style=Google *.c *.h
check:
clang-format -n --style=Google *.c *.h
cppcheck --enable=all --force *.h *.c
if [[ `uname` == "Darwin" ]]; then leaks --atExit -- ./s21_string_tests; fi
if [[ `uname` == "Linux" ]]; then valgrind -s --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=valgrind.log ./s21_string_tests; sleep 1; fi
rebuild: clean all