-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (36 loc) · 1.28 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
INCLUDES = ./includes/
ENGINES = ./includes/engines
COMPONENTS = ./includes/components
OBJECTS_LIB = ./includes/objects
GAMEOBJECTS = ./game_data/objects
IMGUI = ./includes/imgui-1.90.4-docking
CXX = g++
CXXFLAGS += -std=c++20 $(shell sdl2-config --cflags) -g
CXXFLAGS += -I$(IMGUI) -I$(IMGUI)/backends -I$(INCLUDES) -I$(OBJECTS_LIB) -I$(GAMEOBJECTS) -I$(COMPONENTS)
LDFLAGS = -lstdc++ -lSDL2
# List of source files
SOURCES := ./main.cpp \
$(wildcard $(ENGINES)/*.cpp) \
$(wildcard $(COMPONENTS)/*.cpp) \
$(wildcard $(OBJECTS_LIB)/*.cpp) \
$(wildcard $(GAMEOBJECTS)/*.cpp) \
$(wildcard $(IMGUI)/*.cpp) \
$(IMGUI)/backends/imgui_impl_sdl2.cpp \
$(IMGUI)/backends/imgui_impl_sdlrenderer2.cpp \
$(INCLUDES)/tinyxml2.cpp
# List of object files
OBJECTS := $(patsubst %.cpp, %.o, $(SOURCES))
#LIBRARIES := $(patsubst $(GAMEOBJECTS)/%.cpp, $(GAMEOBJECTS)/lib%.so, $(wildcard $(GAMEOBJECTS)/*.cpp))
# Main target
all: fuzzy_engine
%.o: %.cpp
# Rule to compile object files
$(CXX) $(CXXFLAGS) -c -fPIC $< -o $@
$(GAMEOBJECTS)/lib%.so: $(GAMEOBJECTS)/%.o
$(CXX) $(CXXFLAGS) -shared -o $@ $^
# Rule to link the executable
fuzzy_engine: $(OBJECTS) #$(LIBRARIES)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
# Clean rule
clean:
rm -rf $(OBJECTS) fuzzy_engine