-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (39 loc) · 918 Bytes
/
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
##
## EPITECH PROJECT, 2020
## CPool Day 10
## File description:
## makefile
##
NAME = libmy.a
T_NAME = unit_tests
CC = gcc -g
AR = ar rcs
RM = rm -f
SRCS = $(wildcard ./*.c) $(wildcard ./**/*.c)
OBJS = $(SRCS:.c=.o)
T_SRCS = $(wildcard ./tests/*.c) $(wildcard ./tests/**/*.c)
T_OBJS = $(T_SRCS:.c=.o)
ifeq ($(CFLAGS),)
CFLAGS += -I ./include -Wall -Wextra
endif
LDFLAGS = -L .
LDLIBS = -lmy
all: $(NAME)
$(NAME): CFLAGS += $(T_FLAGS)
$(NAME): $(OBJS)
$(AR) $(NAME) $(OBJS)
clean:
$(RM) $(OBJS)
$(RM) $(T_OBJS)
find -type f -name '*.gcno' -delete -o -name '*.gcda' -delete
fclean: clean
$(RM) $(NAME)
$(RM) $(T_NAME)
$(T_NAME): T_FLAGS += -coverage
$(T_NAME): LDLIBS += -lcriterion -lgcov
$(T_NAME): $(NAME) $(T_OBJS)
$(CC) $(CFLAGS) -o $@ $(T_OBJS) $(LDFLAGS) $(LDLIBS)
run_tests: $(T_NAME)
./$^
re: fclean all
.PHONY: all clean fclean re run_tests