-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (29 loc) · 1.1 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
CC = gcc
FLAGS = -Wall -Werror -Wextra -std=c11
SRC_TESTS = main.c $(wildcard tests/*.c)
SRC_FILES=$(wildcard s21_arithmetic/*.c) $(wildcard s21_comparison/*.c) $(wildcard s21_convertors/*.c) $(wildcard helpers/*.c) $(wildcard s21_another/*.c)
GCOVFLAGS = -L. --coverage
TEST_FLAGS = -lcheck
ifeq ($(shell uname), Linux)
TEST_FLAGS += -lpthread -lrt -lsubunit -lm
endif
all: clean check-style s21_decimal.a test gcov_report
s21_decimal.a:
$(CC) $(FLAGS) $(SRC_FILES) -c
ar r s21_decimal.a *.o
rm *.o
test: s21_decimal.a
$(CC) $(FLAGS) -g $(SRC_TESTS) s21_decimal.a $(TEST_FLAGS) -o test
check-style:
clang-format -n -style=Google *.h tests/*.h $(SRC_TESTS) $(SRC_FILES)
set-style:
clang-format -i -style=Google *.h tests/*.h $(SRC_TESTS) $(SRC_FILES)
gcov_report: s21_decimal.a test
$(CC) $(FLAGS) -w $(SRC_TESTS) $(SRC_FILES) s21_decimal.a $(TEST_FLAGS) $(GCOVFLAGS) -o test
./test
@echo "\n\n"
lcov -t s21_test -o test.info -c -d .
genhtml -o test_html test.info
open ./test_html/index.html
clean:
rm -rf *.o *.a *.gch *.gcno *.gcna *.gcda *.info *.out test test_html test.dSYM report_make tests/*.o