-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·55 lines (45 loc) · 1.8 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tnard <tnard@student.42lyon.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/12/09 13:15:12 by tnard #+# #+# #
# Updated: 2021/12/10 11:10:35 by tnard ### ########lyon.fr #
# #
# **************************************************************************** #
BLU = \033[0;34m
GRN = \033[0;32m
RED = \033[0;31m
RST = \033[0m
END = \e[0m
SRCS = <your project.c>
NAME = <your project>
OBJS_DIR = objs/
PROJECT_H = <your project.h>
OBJS = $(SRCS:.c=.o)
OBJECTS_PREFIXED = $(addprefix $(OBJS_DIR), $(OBJS))
CC = gcc
CC_FLAGS = -Wall -Werror -Wextra
$(OBJS_DIR)%.o : %.c $(PROJECT_H)
@mkdir -p $(OBJS_DIR)
@mkdir -p $(OBJS_DIR)srcs
@$(CC) $(CC_FLAGS) -c $< -o $@
@printf "\033[2K\r${BLU}[BUILD]${RST} '$<' $(END)"
$(NAME): $(OBJECTS_PREFIXED) maker
@$(CC) -o $(NAME) $(OBJECTS_PREFIXED) $(CC_FLAGS) <sub project.a>
@printf "\033[2K\r\033[0;32m[END]\033[0m $(NAME)$(END)\n"
all: $(NAME)
maker:
@make -C <sub project>
clean:
@make clean -C <sub project>
@rm -rf $(OBJS_DIR)
@printf "\033[2K\r${GRN}[CLEAN]${RST} done$(END)"
fclean: clean
@make fclean -C <sub project>
@rm -f $(NAME)
@printf "\033[2K\r${GRN}[FCLEAN]${RST} done$(END)"
re: fclean all
.PHONY: all clean fclean re