-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (41 loc) · 1.66 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: adu-pelo <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/05/17 18:10:52 by adu-pelo #+# #+# #
# Updated: 2016/11/09 14:18:27 by adu-pelo ### ########.fr #
# #
# **************************************************************************** #
NAME = ft_select
C_DIR = sources
C_DIRS = $(shell find $(C_DIR) -type d -follow -print)
C_FILES = $(shell find $(C_DIRS) -type f -follow -print | grep -w "[.c]$$")
O_DIR = .tmp/obj
O_DIRS = $(C_DIRS:$(C_DIR)%=$(O_DIR)%)
O_FILES = $(C_FILES:$(C_DIR)%.c=$(O_DIR)%.o)
FLAGS = -Wall -Werror -Wextra
INCS = -Iincludes -Ilibft
LIB = -L./libft -lft -ltermcap
all: $(NAME)
$(NAME): $(O_FILES)
@echo "Creating $(NAME)"
@make -C ./libft
@gcc $(FLAGS) $^ $(LIB) -o $@
$(O_DIR)%.o: $(C_DIR)%.c
@echo "Creating object : $@"
@mkdir -p $(O_DIRS) $(O_DIR)
@gcc $(FLAGS) $(INCS) -o $@ -c $<
clean:
@echo "Deleting objects"
@rm -rf $(O_FILES)
@make clean -C libft
fclean: clean
@echo "Deleting $(NAME)"
@make fclean -C libft
@rm $(NAME) || true
@rm -rf .tmp/
re: fclean all
.PHONY : all clean fclean re