-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (79 loc) · 3.45 KB
/
Makefile
File metadata and controls
92 lines (79 loc) · 3.45 KB
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
#******************************************************************************#
# #
# #
# Makefile #
# #
# By: Daniel & Massilva #
# #
# Created: 2025/04/21 12:11:44 by mmoumini #
# Updated: 2026/01/27 12:14 by Daniel. #
# #
#******************************************************************************#
UNAME_S := $(shell uname -s)
# Detect OS and set variables
ifeq ($(OS),Windows_NT)
# Windows (MinGW/MSYS2)
NAME = FlappyBird.exe
RM = rm -f
RMDIR = rm -rf
LIB_DIR = lib/Windows
LIB_EXT = .a
# Windows static libraries linking (MinGW uses .a files)
# Use --whole-archive for Windows (MinGW doesn't support -force_load)
# Use --start-group/--end-group to handle circular dependencies
SFML_LIBS = -Wl,--whole-archive \
-L$(LIB_DIR) -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-network -lsfml-system \
-Wl,--no-whole-archive \
-Wl,--start-group \
-L$(LIB_DIR) -lvorbisfile -lvorbisenc -lvorbis -logg -lFLAC -lfreetype \
-Wl,--end-group \
-lopengl32 -lwinmm -lgdi32 -lws2_32
else ifeq ($(UNAME_S),Darwin)
# macOS
NAME = FlappyBird
RM = rm -f
RMDIR = rm -rf
LIB_DIR = lib/macOS
LIB_EXT = .a
# macOS static libraries with force_load for Objective-C categories
SFML_LIBS = -Wl,-force_load,$(LIB_DIR)/libsfml-graphics$(LIB_EXT) \
-Wl,-force_load,$(LIB_DIR)/libsfml-window$(LIB_EXT) \
-Wl,-force_load,$(LIB_DIR)/libsfml-audio$(LIB_EXT) \
-Wl,-force_load,$(LIB_DIR)/libsfml-network$(LIB_EXT) \
-Wl,-force_load,$(LIB_DIR)/libsfml-system$(LIB_EXT) \
-L$(LIB_DIR) -lFLAC -lvorbis -lvorbisenc -lvorbisfile -logg -lfreetype \
-framework OpenGL -framework AppKit -framework IOKit \
-framework CoreServices -framework Carbon -framework OpenAL
else
# Linux
NAME = FlappyBird
RM = rm -f
RMDIR = rm -rf
LIB_DIR = lib/linux
LIB_EXT = .a
# Linux static libraries
SFML_LIBS = -Wl,--whole-archive \
-L$(LIB_DIR) -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-network -lsfml-system \
-Wl,--no-whole-archive \
-L$(LIB_DIR) -lFLAC -lvorbis -lvorbisenc -lvorbisfile -logg -lfreetype \
-lGL -lX11 -lpthread -lrt
endif
CC = g++
CFLAGS = -Wall -Wextra -std=c++17 -DSFML_STATIC
INC = -I./include
LIB_PATH = $(SFML_LIBS)
SRC = src/main.cpp src/Bird.cpp src/Background.cpp src/Obstacle.cpp src/Ground.cpp src/ObstacleManager.cpp src/CollisionManager.cpp src/UIManager.cpp
OBJ = $(SRC:.cpp=.o)
all: $(NAME)
$(NAME): $(OBJ)
$(CC) $(OBJ) -o $(NAME) $(CFLAGS) $(LIB_PATH) $(INC)
%.o: %.cpp
$(CC) -c $< -o $@ $(CFLAGS) $(INC)
clean:
@echo "Cleaning object files..."
$(RM) $(OBJ)
fclean: clean
@echo "Cleaning executable..."
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re