-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (61 loc) · 2.05 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
74
75
76
77
78
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: oozkaya <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/11/27 07:29:36 by oozkaya #+# #+# #
# Updated: 2017/12/05 15:01:24 by oozkaya ### ########.fr #
# #
# **************************************************************************** #
.PHONY: all clean fclean re
NAME = fillit
CFLAGS = -Wall -Wextra -Werror
CC = gcc
LIB_PATH = libft
LIB = $(LIB_PATH)/libft.a
LIB_LINK = -L $(LIB_PATH) -lft
INC_DIR = includes
INC_LIB = ./
INCS = -I $(LIB_PATH)/$(INC_LIB) -I $(INC_DIR)
SRC_DIR = src
SRC = main.c\
reader.c\
split_tetris.c\
checker_init.c\
map_creator.c\
get_tm_coord.c\
map_filler.c\
free_allocated_mem.c
OBJ_DIR = obj
SRCS = $(addprefix $(SRC_DIR)/, $(SRC))
OBJS = $(addprefix $(OBJ_DIR)/, $(SRC:.c=.o))
C_NO = "\033[00m"
C_DONE = "\033[35m"
C_GOOD = "\033[32m"
C_ERROR = "\033[31m"
C_WARN = "\033[33m"
SUCCESS = $(C_GOOD)SUCCESS$(C_NO)
DONE = $(C_DONE)DONE$(C_NO)
all: $(NAME)
$(NAME): obj $(OBJS) $(LIB)
@$(CC) $(CFLAGS) $(OBJS) $(LIB_LINK) -o $@
@echo "Compiling -> " $(NAME) $(SUCCESS)
$(LIB):
@make -C $(LIB_PATH)
obj:
@mkdir -p obj
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(INC_DIR)
@$(CC) $(CFLAGS) $(INCS) -c -o $@ $<
@echo "Linking -> " $< $(DONE)
clean:
@rm -f $(OBJS)
@rm -Rf $(OBJ_DIR)
@echo "Cleaning all the Fillit objects -> " $(SUCCESS)
@make -C $(LIB_PATH) clean
fclean: clean
@rm -f $(NAME)
@make -C $(LIB_PATH) clean_only_lib
@echo "Deleting -> " $(NAME) $(SUCCESS)
re: fclean all