-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (50 loc) · 1.32 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
#FORMATTING
GREEN = "\\033[32m"
BOLD = "\\033[1m"
RESET_FORMAT = "\\033[0m"
ERASE_LINE = "\\033[A\\033[K\\033[A"
#COMPILATION
NAME = fillit
SRC_DIR = ./src/
SRC_FILES = build_tetris.c check_file.c check_grid.c fill_grid.c\
get_path.c main.c utils.c
SRC = $(addprefix $(SRC_DIR), $(SRC_FILES))
OBJ_DIR = ./obj/
OBJ_FILES = $(SRC_FILES:.c=.o)
OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILES))
HDR_FILE = fillit.h
HDR_DIR = ./inc/
HDR = $(addprefix $(HDR_DIR), $(HDR_FILE))
LIB_DIR = ./libft/
LIB_INC = ./libft/inc/
LIB_NAME = lft
LIB = $(LIB_DIR)libft.a
CC = gcc
FLAGS = -Wall -Wextra -Werror
all: $(NAME)
$(NAME): $(LIB) $(OBJ)
@echo "Object files related to fillit created"
@$(CC) $(FLAGS) $(OBJ) -I$(LIB_INC) -I$(HDR_DIR) -L$(LIB_DIR) -$(LIB_NAME) -o $(NAME)
@echo "$(BOLD)$(NAME)$(RESET_FORMAT) [$(GREEN)OK$(RESET_FORMAT)]"
$(LIB): FORCE
@make -C $(LIB_DIR)
$(OBJ_DIR)%.o:$(SRC_DIR)%.c $(HDR)
@mkdir -p $(OBJ_DIR)
@$(CC) $(FLAGS) -I$(LIB_INC) -I$(HDR_DIR) -c $< -o $@
@echo "Compiled: $*.o [$(GREEN)OK$(RESET_FORMAT)]"
@echo "$(ERASE_LINE)"
clean:
@make -C $(LIB_DIR) clean
@rm -rf $(OBJ)
@rm -rf $(OBJ_DIR)
@echo "Object files related to fillit deleted"
fclean: clean
@make -C $(LIB_DIR) fclean
@rm -rf $(NAME)
@echo "$(NAME) deleted"
re:
@$(MAKE) fclean
@echo ""
@$(MAKE) all
FORCE:
.PHONY: all clean fclean re FORCE