-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (55 loc) · 2.54 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: vtouffet <vtouffet@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/11/13 13:08:42 by vtouffet #+# #+# #
# Updated: 2019/08/15 17:28:07 by vtouffet ### ########.fr #
# #
# **************************************************************************** #
NAME=editor
SRCS_PATH=./srcs/
SRCS_FILES=cli.c display.c events.c file.c init.c texture.c resize.c utils.c display_ui.c free.c
SRCS=$(addprefix $(SRCS_PATH), $(SRCS_FILES))
OBJECTS_PATH=./objs/
OBJECTS_FILES=$(SRCS_FILES:.c=.o)
OBJECTS=$(addprefix $(OBJECTS_PATH), $(OBJECTS_FILES))
COMPILE=gcc -Wall -Wextra -Werror
INCLUDES=-I./includes -I./libs/libft
#-I/Users/valentin/Downloads/minilibx_macos
HEADER=./includes/editor.h
MLX=-L/usr/local/lib -I/usr/local/include -lmlx -framework OpenGL -framework AppKit
#MLX=-I~/Downloads/minilibx_macos ~/Downloads/minilibx_macos/libmlx.a -framework OpenGL -framework AppKit
LIB_NAME=libft.a
LIB_PATH=./libs/libft/
LIB=$(LIB_PATH)$(LIB_NAME)
GNL=./libs/get_next_line/get_next_line.c
COLOR_RESET=\033[0m
COLOR_PENDING=\033[0;33m
COLOR_SUCCESS=\033[0;32m
COLOR_DEFAULT=\033[1;34m
all: $(NAME)
$(NAME): $(OBJECTS) $(HEADER)
@echo "$(LIB_NAME) [$(COLOR_PENDING)Compiling...$(COLOR_RESET)]"
@make -C $(LIB_PATH) > /dev/null
@echo "\033[A\033[K\033[A"
@echo "$(LIB_NAME) [$(COLOR_SUCCESS)OK$(COLOR_RESET)]"
@echo "$(NAME) [$(COLOR_PENDING)Compiling...$(COLOR_RESET)]"
@$(COMPILE) $(OBJECTS) $(MLX) $(LIB) $(GNL) -o $(NAME) > /dev/null
@echo "\033[A\033[K\033[A"
@echo "$(NAME) [$(COLOR_SUCCESS)OK$(COLOR_RESET)]"
@echo " [$(COLOR_SUCCESS)DONE$(COLOR_RESET)]"
$(OBJECTS_PATH)%.o: $(SRCS_PATH)%.c
@mkdir $(OBJECTS_PATH) 2>/dev/null || echo "" > /dev/null
@$(COMPILE) $(INCLUDES) -c $< -o $@
@echo "Compiled $@" > /dev/null
clean:
@make -C $(LIB_PATH) clean > /dev/null
@rm -rfv $(OBJECTS) > /dev/null
fclean: clean
@make -C $(LIB_PATH) fclean > /dev/null
@rm -rfv $(NAME) > /dev/null
re: fclean all
.PHONY: clean fclean re all