-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
73 lines (52 loc) · 1.38 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
##
## EPITECH PROJECT, 2018
## NEED4STEAK
## File description:
## Makefile of N4S
##
CC = gcc
EXT = .c
NAME = ai
SRCDIR = sources/
INCDIR = include/
SRC = ${SRCDIR}main \
${SRCDIR}ia \
${SRCDIR}detect_end \
${SRCDIR}direction \
${SRCDIR}speed
NOM = $(basename $(notdir $(SRC)))
OBJ = $(addprefix objects/, $(addsuffix .o, $(NOM)))
LIB = ${INCDIR}lib/
CFLAGS = -I${INCDIR} -I$(LIB)${INCDIR} ${WARN} -Wall -Wextra -L$(LIB) -llib
RED =\033[0m\e[1m\e[31m
GREEN =\033[0m\e[1m\e[32m
NC =\033[0m
GREY =\033[40m
BG_CL =\033[42m
NOPRINT = --no-print-directory -C
all: $(NAME)
$(NAME): $(OBJ) | objects/
@$(CC) -o $(NAME) $(OBJ) ${LIB}lib.a
@echo -e '${BG_CL}| Flags : $(CFLAGS)${NC}'
@echo -e '${GREEN}╰ Create${NC} : ${GREY}./$(NAME)${NC}'
lib:
objects/%.o: sources/%.c | objects
@mkdir -p objects
@$(CC) $(CFLAGS) -c $< -o $@
@echo -e "${GREEN}| [OK]${GREEN} " $< "${NC}" || echo -e "\e[91;5m| [KO]\e[25m " $< "${NC}"
objects:
@${MAKE} ${NOPRINT} ${LIB}
@mkdir -p $@
@echo -e '${GREEN}╭ Object${NC} : objects/ dir create'
clean:
@rm -f $(OBJ)
@${MAKE} clean ${NOPRINT} ${LIB}
@echo -e '${RED}| Clean${NC} : OK'
fclean: clean
@${MAKE} fclean ${NOPRINT} ${LIB}
@$(RM) -r objects
@$(RM) $(NAME)
@echo -e '${RED}| Fclean${NC} : $(NAME) removed'
@echo -e '${RED}╰ Fclean${NC} : objects/ dir removed'
re: fclean all
.PHONY: all clean fclean re