-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (35 loc) · 926 Bytes
/
Makefile
File metadata and controls
46 lines (35 loc) · 926 Bytes
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
##
## EPITECH PROJECT, 2018
## libmy
## File description:
## The library main Makefile.
##
CC = gcc
CFLAGS = -Iinclude -O2 -pipe
CFLAGS += -Wall -Wextra -Wshadow -Wuninitialized -Wformat-security
LDFLAGS = -L.
LDLIBS = -lmy
NAME = libmy.a
TEST_NAME = unit-tests
SRCS = $(wildcard src/*.c) $(wildcard src/**/*.c)
OBJS = $(SRCS:.c=.o)
TEST_SRCS = $(wildcard test/*.c) $(wildcard test/**/*.c)
TEST_OBJS = $(TEST_SRCS:.c=.o)
all: $(NAME)
$(NAME): CFLAGS += $(TEST_FLAGS)
$(NAME): $(OBJS)
$(AR) rcs $(NAME) $(OBJS)
clean:
$(RM) src/*.o src/*.gc* src/**/*.o src/**/*.gc*
$(RM) test/*.o test/*.gc* test/**/*.o test/**/*.gc*
fclean: clean
$(RM) $(NAME)
$(RM) $(TEST_NAME)
$(TEST_NAME): TEST_FLAGS += -coverage
$(TEST_NAME): LDLIBS += -lcriterion -lgcov
$(TEST_NAME): $(NAME) $(TEST_OBJS)
$(CC) $(CFLAGS) -o $@ $(TEST_OBJS) $(LDFLAGS) $(LDLIBS)
test: $(TEST_NAME)
./$^
re: fclean all
.PHONY: all clean fclean re test