-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (40 loc) · 1.32 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
##
## KAP PROJECT, 2023
## C Lib - Makefile
## File description:
## Makefile for kap C Lib
##
include ./includes/Makefile
include ./src/Makefile
include ./tests/Makefile
NAME = libkap.a
GCC = gcc
C_FLAGS = -fprofile-arcs -ftest-coverage -Wnonnull -g
.Phony: all clean fclean re run_tests build_tests
all: $(NAME)
.c.o:
@$(GCC) -c $< -o $@ $(KAP_INCLUDES) $(C_FLAGS)
@echo "[KAP C LIB] => $@ Compiling $<"
$(NAME): $(OBJ)
@ar rc $(NAME) $(OBJ)
build_tests: all $(OBJ_TESTS)
@$(GCC) -o kap_tests $(OBJ_TESTS) $(NAME) $(KAP_INCLUDES) -lcriterion --coverage
@echo "[KAP C LIB] =>\033[0;32m Building tests \033[0m"
check_coverage:
@echo "[KAP C LIB] =>\033[0;32m Checking coverage \033[0m"
@gcovr -r . $(GCOVR_EXCLUDES) --html-details coverage/coverage.html --xml result_coverage.xml
start_runnig_tests: build_tests
@echo "[KAP C LIB] =>\033[0;32m Running tests \033[0m"
@./kap_tests --xml=result_tests.xml || echo "[KAP C LIB] =>\033[0;31m Tests failed \033[0m"
run_tests: build_tests start_runnig_tests check_coverage
clean:
@rm -f $(OBJ)
@rm -f $(OBJ_TESTS)
@find . -name "*.gcda" -type f -delete
@find . -name "*.gcno" -type f -delete
@echo "[KAP C LIB] => $@ Cleaning"
fclean: clean
@rm -f $(NAME)
@rm -f kap_tests
@echo "[KAP C LIB] => $@ Cleaning"
re: fclean all