forked from insearcher/guimp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
246 lines (202 loc) · 8.08 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: edraugr- <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/03/07 15:58:51 by sbednar #+# #+# #
# Updated: 2019/07/12 18:03:49 by edraugr- ### ########.fr #
# #
# **************************************************************************** #
include Makefile.inc
NAME = guimp
NAME_TEST = guimp_test
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
UI_DIR = ./libui
JTOC_DIR = ./libjtoc
INC_FT = $(FT_DIR)/include
INC_UI = $(UI_DIR)/include
INC_JTOC = $(JTOC_DIR)/include
INC_DIR = ./include
SRC_DIR = ./src
OBJ_DIR = ./obj
SRC = main.c \
draw_main_canvas_event.c \
draw_with_selected_tool.c \
gm_init.c \
ui_main_fill_default_functions.c \
gm_generate_surfaces_id.c \
color_sliders.c \
get_value_from_slider.c \
process_tmp_layer.c
SRC_TOOLS = brush.c \
ellipse.c \
eraser.c \
filler.c \
hand.c \
line.c \
modes.c \
pipette.c \
rect.c \
square.c \
zoom.c \
text.c
OBJ = $(addprefix $(OBJ_DIR)/,$(SRC:.c=.o)) \
$(addprefix $(OBJ_DIR)/,$(SRC_TOOLS:.c=.o))
##########################################################################################################
SRC_DIR_TEST = ./src/test
OBJ_DIR_TEST = ./obj_test
SRC_TEST = main.c \
draw_func.c \
draw_main_canvas_event.c \
OBJ_TEST = $(addprefix $(OBJ_DIR_TEST)/,$(SRC_TEST:.c=.o))
##########################################################################################################
INCS = -I$(INC_DIR) \
-I$(INC_FT) \
-I$(INC_UI) \
-I$(INC_JTOC) \
-I./frameworks/SDL2.framework/Versions/A/Headers \
-I./frameworks/SDL2_image.framework/Versions/A/Headers \
-I./frameworks/SDL2_ttf.framework/Versions/A/Headers \
FRAMEWORKS = -F./frameworks \
-rpath ./frameworks \
-framework OpenGL -framework AppKit -framework OpenCl \
-framework SDL2 -framework SDL2_ttf -framework SDL2_image
LIBS = -L$(FT_DIR) -lft \
-L$(UI_DIR) -lui \
-L$(JTOC_DIR) -ljtoc
CC = gcc
# CFLAGS = -Wall -Wextra -Werror -g
CFLAGS = -g
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)LIBUI:$(TEXT_R)"
@make -C $(UI_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) $(FRAMEWORKS) -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)/tools/%.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)LIBUI:$(TEXT_R)"
@make -C $(UI_DIR) clean
@echo "$(TEXT_CR)$(TEXT_B)LIBJTOC:$(TEXT_R)"
@make -C $(JTOC_DIR) clean
@echo "$(TEXT_CR)$(TEXT_B)GUIMP:$(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)LIBUI:$(TEXT_R)"
@make -C $(UI_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
##########################################################################################################
test: rm_test $(NAME_TEST)
rm_test:
rm -f $(NAME_TEST)
rm -rf $(OBJ_DIR_TEST)
$(NAME_TEST):
@echo "$(TEXT_CC)$(TEXT_B)↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ test$(TEXT_R)"
@touch $(TEMP)
@echo "$(TEXT_CR)$(TEXT_B)LIBFT:$(TEXT_R)"
@make -C $(FT_DIR) all
@echo "$(TEXT_CR)$(TEXT_B)LIBUI:$(TEXT_R)"
@make -C $(UI_DIR) all
@echo "$(TEXT_CR)$(TEXT_B)LIBJTOC:$(TEXT_R)"
@make -C $(JTOC_DIR) all
@echo "$(TEXT_CR)$(TEXT_B)$(NAME_TEST):$(TEXT_R)"
@make $(OBJ_DIR_TEST)
@make compile_test
@rm -f $(TEMP)
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
compile_test: $(OBJ_TEST)
@if [ $(CAT_TEMP) ] ; \
then \
make build_test;\
fi;
build_test:
$(CC) $(CFLAGS) $(OBJ_TEST) $(INCS) $(LIBS) $(FRAMEWORKS) -o $(NAME_TEST) # -fsanitize=address
$(OBJ_DIR_TEST):
@mkdir $(OBJ_DIR_TEST)
$(OBJ_DIR_TEST)/%.o: $(SRC_DIR_TEST)/%.c
$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
@echo "1" > $(TEMP)
clean_t:
@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)LIBUI:$(TEXT_R)"
@make -C $(UI_DIR) clean
@echo "$(TEXT_CR)$(TEXT_B)LIBJTOC:$(TEXT_R)"
@make -C $(JTOC_DIR) clean
@echo "$(TEXT_CR)$(TEXT_B)GUIMP:$(TEXT_R)"
@rm -f $(TEMP)
rm -rf $(OBJ_DIR_TEST)
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
fclean_t:
@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)LIBUI:$(TEXT_R)"
@make -C $(UI_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_TEST)
rm -f $(NAME_TEST)
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
re_t: fclean_t test
##########################################################################################################
norm:
@echo "$(TEXT_CC)$(TEXT_B)↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ norminette$(TEXT_R)"
@norminette $(SRC_DIR)
@norminette $(INC_DIR)
@norminette $(UI_DIR)/src
@norminette $(UI_DIR)/inc
@echo "$(TEXT_CG)$(TEXT_BL)$(TEXT_B)↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ success$(TEXT_R)"
.PHONY: all $(NAME) clean fclean re norm