This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
67 lines (62 loc) · 2.86 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: omiroshn <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/01/31 22:19:29 by omiroshn #+# #+# #
# Updated: 2018/01/31 22:19:34 by omiroshn ### ########.fr #
# #
# **************************************************************************** #
NAME = wolf3d
CC = clang
FILES = main draw event load_textures put_error read_map system keys \
draw_wall draw_sprite draw_floor
LIBFT_DIR = libft/
SRC = $(addprefix src/, $(addsuffix .c, $(FILES)))
OBJ = $(addprefix obj/, $(addsuffix .o, $(FILES)))
OBJ_LIST = $(addsuffix .o, $(FILES))
SDL_CFLAGS = $(shell sdl2-config --cflags)
SPEED = -O3
FLAGS = -Wall -Wextra -Werror
HEADERS = -I./includes -I./libft/includes
OS = $(shell uname)
ifeq ($(OS), Linux)
CGFLAGS = `sdl2-config --cflags --libs` -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm
else
CGFLAGS = -framework OpenGL -framework AppKit
INCLUDES = -I./frameworks/SDL2.framework/Versions/A/Headers \
-I./frameworks/SDL2_ttf.framework/Versions/A/Headers \
-I./frameworks/SDL2_image.framework/Versions/A/Headers \
-I./frameworks/SDL2_mixer.framework/Headers \
-F./frameworks/
FRAMEWORKS = -F./frameworks \
-rpath ./frameworks \
-framework OpenGL -framework AppKit -framework OpenCl \
-framework SDL2 -framework SDL2_ttf -framework SDL2_image \
-framework SDL2_mixer
endif
all: $(NAME)
.PHONY: all clean
.NOTPARALLEL: all $(NAME) clean fclean re
$(NAME): libft/libft.a $(OBJ)
@echo "\033[36mLinking...\033[0m"
@$(CC) -o $(NAME) $(FLAGS) $(SPEED) $(OBJ) $(CGFLAGS) $(FRAMEWORKS) libft/libft.a
@echo "\033[32m[ ✔ ] Binary \033[1;32m$(NAME)\033[1;0m\033[32m created.\033[0m"
libft/libft.a:
@make --no-print-directory -j3 -C $(LIBFT_DIR)
obj/%.o: src/%.c
@$(CC) -o $@ $(FLAGS) $(SPEED) $(HEADERS) $(INCLUDES) -c $^
@echo "\033[37mCompilation of \033[97m$(notdir $<) \033[0m\033[37mdone. \033[0m"
clean:
@rm -f $(OBJ)
@make --no-print-directory -j3 -C libft/ clean
@echo "\033[31m[ ✔ ] Objects files \033[91m$(OBJ_LIST) \033[0m\033[31m removed. \033[0m"
fclean:
@rm -rf $(OBJ)
@rm -f $(NAME)
@make --no-print-directory -j3 -C libft/ fclean
@echo "\033[31m[ ✔ ] Objects files \033[91m$(OBJ_LIST) \033[0m\033[31m removed. \033[0m"
@echo "\033[31m[ ✔ ] Binary \033[1;31m$(NAME) \033[1;0m\033[31mremoved.\033[0m"
re: fclean all