-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
106 lines (85 loc) · 3.16 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jcluzet <jcluzet@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/08/08 21:27:58 by jcluzet #+# #+# #
# Updated: 2021/08/12 20:18:22 by jcluzet ### ########.fr #
# #
# **************************************************************************** #
NAME = so_long
NAMEBONUS = so_long_bonus
MLX = libmlx.a
SRCS = so_long.c \
display/* \
parsing/* \
GNL/* \
utils/*
SRCS_BONUS = bonus/so_long.c \
bonus/display/* \
bonus/parsing/* \
bonus/GNL/* \
bonus/utils/*
CC = clang
CFLAGS = -Wall -Wextra -Werror
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
$(NAME):
@echo "\033[33m[Compilation of so_long...]"
@ $(MAKE) -C mlx all >/dev/null 2>&1
@ cp ./mlx/$(MLX) .
@$(CC) $(CFLAGS) -g3 -Ofast -o $(NAME) -Imlx $(SRCS) -g -fsanitize=address -Lmlx -lmlx -lm -framework OpenGL -framework AppKit
@echo "\033[32m[ ./so_long created ]"
endif
ifeq ($(UNAME), Linux)
$(NAME):
@echo "\033[31;1mCompiling for Linux...\033[0m"
@chmod 777 mlx_linux/configure
@ $(MAKE) -C mlx_linux all
$(CC) $(CFLAGS) -g3 -o $(NAME) $(SRCS) -Imlx_linux -Lmlx_linux -lmlx -lmlx_Linux -L/usr/lib -lXext -lX11 -lm
@echo "\033[32m[ ./so_long created ]"
endif
all: $(NAME)
ifeq ($(UNAME), Darwin)
bonus: $(NAME_BONUS)
@echo "\033[33m[so_long MACOS compilation with bonus...]"
@ $(MAKE) -C mlx all
@ cp ./mlx/$(MLX) .
$(CC) $(CFLAGS) -g3 -Ofast -o $(NAMEBONUS) -Imlx $(SRCS_BONUS) -g -fsanitize=address -Lmlx -lmlx -lm -framework OpenGL -framework AppKit
@echo "\033[32m[ ./so_long_bonus created ]"
endif
ifeq ($(UNAME), Linux)
bonus: $(NAME_BONUS)
@echo "\033[33m[so_long Linux compilation with bonus...]"
@chmod 777 mlx_linux/configure
@ $(MAKE) -C mlx_linux all
$(CC) $(CFLAGS) -g3 -o $(NAMEBONUS) $(SRCS_BONUS) -Imlx_linux -Lmlx_linux -lmlx -lmlx_Linux -L/usr/lib -lXext -lX11 -lm
@echo "\033[32m[ ./so_long_bonus created ]"
endif
ifeq ($(UNAME), Darwin)
clean:
@ echo "\033[31m[Remove last version...]"
@ $(MAKE) -C mlx clean
@ rm -rf so_long.dSYM so_long_bonus.dSYM >/dev/null 2>&1
endif
ifeq ($(UNAME), Linux)
clean:
@ echo "\033[31m[Remove last version...]"
@ $(MAKE) -C mlx_linux clean
@ rm -rf so_long.dSYM so_long_bonus.dSYM >/dev/null 2>&1
endif
ifeq ($(UNAME), Darwin)
fclean: clean
@ rm $(MLX)
@ rm so_long >/dev/null 2>&1
@ rm so_long_bonus >/dev/null 2>&1
endif
ifeq ($(UNAME), Linux)
fclean: clean
@ rm so_long >/dev/null 2>&1
@ rm so_long_bonus >/dev/null 2>&1
endif
re: fclean all
.PHONY: $(NAME) all bonus test clean fclean re