-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (35 loc) · 1.1 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
NAME = cub3d
HEADERS = includes/*.h
SRC_DIR = srcs
OBJ_DIR = objs
SRC = $(wildcard $(SRC_DIR)/*.c) $(wildcard $(SRC_DIR)/*/*.c)
OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
CC = cc
CFLAGS = -Wall -Wextra -Werror
LIBS = libft/libft.a minilibx/libmlx.a
INC = -I ./includes -I ./minilibx -I ./libft/includes
LIBS_FLAGS = -L ./libft -lft -L ./minilibx -lmlx -framework OpenGL -framework AppKit
all: $(NAME)
$(NAME): $(OBJ)
$(CC) $(CFLAGS) $(INC) $(LIBS_FLAGS) $? -o $@
@echo "\033[1m\033[32mAll successfully compiled\033[39m"
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(LIBS) $(HEADERS)
@mkdir -p $(OBJ_DIR)
@mkdir -p $(@:/$(notdir $@)=)
$(CC) $(CFLAGS) -c $< -o $@
$(LIBS):
@make -C libft/
@make -C minilibx/
clean:
rm -rf $(OBJ_DIR)
make clean -C libft/
make clean -C minilibx/
@echo "\033[1m\033[33mCleaning Object Files\033[39m"
fclean: clean
make fclean -C libft/
rm -f $(NAME)
@echo "\033[1m\033[31mPurged Objects and Executables\033[39m"
norm:
norminette libft/ srcs/ includes/ | grep Error || echo OK!
re: fclean all
.PHONY: all clean fclean re norm