-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
128 lines (74 loc) · 2.29 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
##
## EPITECH PROJECT, 2023
## B-OOP-400-REN-4-1-arcade-martin.boucault
## File description:
## Makefile
##
#DIRECTORY
GAME_DIR = Borne/games/
SNAKE_DIR = Snake/
NIBBLER_DIR = Nibbler/
DISPLAY_DIR = Borne/display/
NCURSES_DIR = NCURSES/
SDL_DIR = SDL/
SFML_DIR = SFML/
CORE_DIR = Borne/core/
LIB_DIR = lib/
#CORE
NAME_CORE = arcade
SRC_CORE = $(CORE_DIR)Core.cpp \
$(CORE_DIR)DLLoader.cpp \
OBJ_CORE = $(SRC_CORE:.cpp=.o)
#FLAGS
CFLAGS = -Wall -Werror
SHARED_FLAGS = -shared -fpic
LDFLAGS = -ldl
# SNAKE
SRC_SNAKE = $(GAME_DIR)$(SNAKE_DIR)Snake.cpp \
NAME_SNAKE = $(LIB_DIR)arcade_snake.so
OBJ_SNAKE = $(SRC_SNAKE:.cpp=.o)
#NIBBLER
SRC_NIBBLER = $(GAME_DIR)$(NIBBLER_DIR)Nibbler.cpp \
NAME_NIBBLER = $(LIB_DIR)arcade_nibbler.so
OBJ_NIBBLER = $(SRC_NIBBLER:.cpp=.o)
#NCURSES
SRC_NCURSES = $(DISPLAY_DIR)$(NCURSES_DIR)Ncurses.cpp \
NAME_NCURSES = $(LIB_DIR)arcade_ncurses.so
OBJ_NCURSES = $(SRC_NCURSES:.cpp=.o)
#SDL
SRC_SDL = $(DISPLAY_DIR)$(SDL_DIR)Sdl.cpp \
NAME_SDL = $(LIB_DIR)arcade_sdl2.so
OBJ_SDL = $(SRC_SDL:.cpp=.o)
#SFML
SRC_SFML = $(DISPLAY_DIR)$(SFML_DIR)Sfml.cpp \
NAME_SFML = $(LIB_DIR)arcade_sfml.so
OBJ_SFML = $(SRC_SFML:.cpp=.o)
all: games graphicals core
games: $(NAME_SNAKE) $(NAME_NIBBLER)
graphicals: $(NAME_NCURSES) $(NAME_SDL) $(NAME_SFML)
core: $(NAME_CORE)
$(NAME_SNAKE):
mkdir -p lib/
g++ -std=c++20 $(SRC_SNAKE) -o $(NAME_SNAKE) $(CFLAGS) $(SHARED_FLAGS)
$(NAME_NIBBLER):
g++ -std=c++20 $(SRC_NIBBLER) -o $(NAME_NIBBLER) $(CFLAGS) $(SHARED_FLAGS)
$(NAME_NCURSES):
mkdir -p lib/
g++ -std=c++20 $(SRC_NCURSES) -o $(NAME_NCURSES) $(CFLAGS) $(SHARED_FLAGS) -lncurses -lpanel -ltinfo
$(NAME_SDL):
g++ -std=c++20 $(SRC_SDL) -fno-gnu-unique -o $(NAME_SDL) $(CFLAGS) $(SHARED_FLAGS) -D_REENTRANT -lSDL2 -lSDL2_ttf -L/usr/lib64
$(NAME_SFML):
g++ -std=c++20 $(SRC_SFML) -o $(NAME_SFML) $(CFLAGS) $(SHARED_FLAGS) -lsfml-graphics -lsfml-window -lsfml-system
$(NAME_CORE):
g++ -std=c++20 $(SRC_CORE) -fno-gnu-unique -o $(NAME_CORE) $(CFLAGS) $(LDFLAGS)
clean:
rm -f $(OBJ_CORE) $(OBJ_NCURSES) $(OBJ_NIBBLER) $(OBJ_SDL) $(OBJ_SFML) $(OBJ_SNAKE)
fclean: clean
rm -f $(NAME_CORE) $(NAME_NCURSES) $(NAME_NIBBLER) $(NAME_SDL) $(NAME_SFML) $(NAME_SNAKE) vgcore.*
re: fclean all
debug: CFLAGS += -g
debug: re
.PHONY : games
.PHONY : libs
.PHONY : core
.PHONY : all