forked from GodFlight/Wolf3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (120 loc) · 4.64 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: edraugr- <edraugr-@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/03/07 15:58:51 by sbednar #+# #+# #
# Updated: 2019/08/29 06:51:52 by rkeli ### ########.fr #
# #
# **************************************************************************** #
include Makefile.inc
NAME = wolf3d
TEXT_R = \033[0m
TEXT_B = \033[1m
TEXT_BL = \033[5m
TEXT_CR = \033[31m
TEXT_CG = \033[32m
TEXT_CY = \033[33m
TEXT_CB = \033[34m
TEXT_CM = \033[35m
TEXT_CC = \033[36m
FT_DIR = ./libft
JTOC_DIR = ./libjtoc
SDL_DIR = /opt/homebrew/lib
INC_FT = $(FT_DIR)/include
INC_JTOC = $(JTOC_DIR)/include
INC_DIR = ./include
SRC_DIR = ./src
OBJ_DIR = ./obj
SRC = draw_objects.c \
draw_loop.c \
main.c \
physic_loop.c \
raycast_helper.c \
sound.c \
init.c \
main_loop.c \
raycast_and_draw.c \
screaming_control.c \
utilits.c \
SRC_JTOC = rc_jtoc_get_default_walls.c \
rc_jtoc_get_walls.c \
rc_jtoc_processing_map.c \
rc_jtoc_get_map.c \
rc_jtoc_get_player.c \
rc_jtoc_get_objects.c \
rc_jtoc_main_from_json.c \
rc_jtoc_utilits.c \
rc_jtoc_get_textures.c \
rc_jtoc_win_from_json.c
OBJ = $(addprefix $(OBJ_DIR)/,$(SRC:.c=.o)) \
$(addprefix $(OBJ_DIR)/,$(SRC_JTOC:.c=.o))
INCS = -I$(INC_DIR) \
-I$(INC_FT) \
-I$(INC_JTOC) \
-I/opt/homebrew/include/SDL2
LIBS = -L$(FT_DIR) -lft \
-L$(JTOC_DIR) -ljtoc \
-L$(SDL_DIR) -lSDL2 \
-L$(SDL_DIR) -lSDL2_Image \
-L$(SDL_DIR) -lSDL2_Mixer
CC = gcc
CFLAGS = -Wall -Wextra -Werror -O3
all: $(NAME)
$(NAME):
@echo "$(TEXT_CC)$(TEXT_B)↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ all$(TEXT_R)"
@touch $(TEMP)
@echo "$(TEXT_CR)$(TEXT_B)LIBFT:$(TEXT_R)"
@make -C $(FT_DIR) all
@echo "$(TEXT_CR)$(TEXT_B)LIBJTOC:$(TEXT_R)"
@make -C $(JTOC_DIR) all
@echo "$(TEXT_CR)$(TEXT_B)$(NAME):$(TEXT_R)"
@make $(OBJ_DIR)
@make compile
@rm -f $(TEMP)
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
compile: $(OBJ)
@if [ $(CAT_TEMP) ] ; \
then \
make build;\
fi;
build:
$(CC) $(CFLAGS) $(OBJ) $(INCS) $(LIBS) -o $(NAME)
$(OBJ_DIR):
@mkdir $(OBJ_DIR)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
@echo "1" > $(TEMP)
$(OBJ_DIR)/%.o: $(SRC_DIR)/rc_jtoc/%.c
$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
@echo "1" > $(TEMP)
clean:
@echo "$(TEXT_CC)$(TEXT_B)↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ clean$(TEXT_R)"
@echo "$(TEXT_CR)$(TEXT_B)LIBFT:$(TEXT_R)"
@make -C $(FT_DIR) clean
@echo "$(TEXT_CR)$(TEXT_B)LIBJTOC:$(TEXT_R)"
@make -C $(JTOC_DIR) clean
@echo "$(TEXT_CR)$(TEXT_B)WOLF3d:$(TEXT_R)"
@rm -f $(TEMP)
rm -rf $(OBJ_DIR)
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
fclean:
@echo "$(TEXT_CC)$(TEXT_B)↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ fclean$(TEXT_R)"
@echo "$(TEXT_CR)$(TEXT_B)LIBFT:$(TEXT_R)"
@make -C $(FT_DIR) fclean
@echo "$(TEXT_CR)$(TEXT_B)LIBJTOC:$(TEXT_R)"
@make -C $(JTOC_DIR) fclean
@echo "$(TEXT_CR)$(TEXT_B)$(NAME):$(TEXT_R)"
@rm -f $(TEMP)
rm -rf $(OBJ_DIR)
rm -f $(NAME)
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
re: fclean all
norm:
@echo "$(TEXT_CC)$(TEXT_B)↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ norminette$(TEXT_R)"
@norminette $(SRC_DIR)
@norminette $(INC_DIR)
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
.PHONY: all $(NAME) clean fclean re norm