-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (60 loc) · 1.65 KB
/
Copy pathMakefile
File metadata and controls
71 lines (60 loc) · 1.65 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
# Compiler
CXX = g++
# Compiler Flags
CXXFLAGS = -Wall -std=c++17 -O2 $(shell sdl2-config --cflags) -I/usr/include/v8 -Iheaders
# Linker Flags (for SDL2)
LDFLAGS = $(shell sdl2-config --libs) -lSDL2main -lSDL2 -lzmq -lpthread -lv8
# Source files
SRC = src/main.cpp \
src/cleanup.cpp \
src/entity_manager.cpp \
src/draw.cpp \
src/init.cpp \
src/physics.cpp \
src/scaling.cpp \
src/entity.cpp \
src/input.cpp \
src/movement_pattern.cpp \
src/shape.cpp \
src/structs.cpp \
src/client.cpp \
src/server.cpp \
src/timeline.cpp \
src/camera.cpp \
src/collision_utils.cpp \
src/event_manager.cpp \
src/collision_handler.cpp \
src/death_handler.cpp \
src/respawn_handler.cpp \
src/input_handler.cpp \
src/disconnectHandler.cpp \
src/replay_recorder.cpp \
src/movement_handler.cpp \
src/position_handler.cpp \
src/v8helpers.cpp \
src/script_manager.cpp \
src/event_manager_bindings.cpp \
src/entity_bindings.cpp \
# Object directory
OBJDIR = obj
# Object files
OBJ = $(SRC:src/%.cpp=$(OBJDIR)/%.o)
# Executable name
EXEC = main
# Default target
all: $(EXEC)
# Ensure obj directory exists
$(OBJDIR):
mkdir -p $(OBJDIR)
# Linking the executable
$(EXEC): $(OBJ)
$(CXX) $(OBJ) -o $(EXEC) $(LDFLAGS)
# Compiling each .cpp file into .o files and place them in obj directory
$(OBJDIR)/%.o: src/%.cpp | $(OBJDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean up object files and executable but keep the obj directory
clean:
@if [ -d $(OBJDIR) ]; then rm -f $(OBJDIR)/*.o; fi
rm -f $(EXEC)
# Phony targets
.PHONY: all clean