-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
68 lines (49 loc) · 2.4 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
CC := g++
LD := g++
CXXFLAGS := -g
LDFLAGS := -g -fopenmp -lprofiler -lsfml-graphics -lsfml-window -lsfml-system -llua -lluavm -lthor-d
SRC_DIR := debug events input game game/ECS gui rendering resources scripting
BUILD_DIR := $(addprefix build/,$(SRC_DIR))
# ALL SRCS AND OBJECTS FOR BUILDING GAME
SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp))
INCLUDES := $(addprefix -I,$(SRC_DIR)) -I/usr/include/SFML -I/usr/include/luavm -I/usr/include/Thor
OBJ := $(patsubst %.cpp,build/%.o,$(SRC))
#SPECIFIC MODULE OBJS
EVENTS_OBJ := $(patsubst %.cpp,build/%.o,$(wildcard events/*.cpp))
INPUT_OBJ := $(patsubst %.cpp,build/%.o,$(wildcard input/*.cpp))
SCRIPTING_OBJ := $(patsubst %.cpp,build/%.o,$(wildcard scripting/*.cpp))
GUI_OBJ := $(patsubst %.cpp,build/%.o,$(wildcard gui/*.cpp))
RESOURCES_OBJ := $(patsubst %.cpp,build/%.o,$(wildcard resources/*.cpp))
GAME_OBJ := $(patsubst %.cpp,build/%.o,$(wildcard game/*.cpp))
vpath %.cpp $(SRC_DIR)
.PHONY: clean events input coyoteiso peek
coyoteiso: coyoteiso
events: $(EVENTS_OBJ) $(INPUT_OBJ) dummy_main_events
input: $(INPUT_OBJ) $(EVENTS_OBJ) dummy_main_input
scripting: $(SCRIPTING_OBJ) dummy_main_scripting
gui: $(GUI_OBJ) $(SCRIPTING_OBJ) $(RESOURCES_OBJ) $(INPUT_OBJ) dummy_main_gui
game: $(GAME_OBJ) $(GUI_OBJ) $(EVENTS_OBJ) $(RESOURCES_OBJ) $(INPUT_OBJ) $(SCRIPTING_OBJ) dummy_main_game
resources: $(RESOURCES_OBJ) dummy_main_resources
define make-goal
$1/%.o: %.cpp
$(CC) $(CXXFLAGS) $(INCLUDES) -c $$< -o $$@
endef
coyoteiso: main.cpp $(OBJ)
$(LD) $(INCLUDES) $^ -o $@ $(LDFLAGS)
dummy_main_events: dummy_main_events.cpp $(EVENTS_OBJ) $(INPUT_OBJ)
$(LD) $(INCLUDES) $^ -o $@ $(LDFLAGS)
dummy_main_input: dummy_main_input.cpp $(INPUT_OBJ) $(EVENTS_OBJ)
$(LD) $(INCLUDES) $^ -o $@ $(LDFLAGS)
dummy_main_scripting: dummy_main_scripting.cpp $(SCRIPTING_OBJ) $(EVENTS_OBJ)
$(LD) $(INCLUDES) $^ -o $@ $(LDFLAGS)
dummy_main_gui: dummy_main_gui.cpp $(GUI_OBJ) $(EVENTS_OBJ) $(SCRIPTING_OBJ) $(RESOURCES_OBJ) $(INPUT_OBJ)
$(LD) $(INCLUDES) $^ -o $@ $(LDFLAGS)
dummy_main_game: dummy_main_game.cpp $(GAME_OBJ) $(GUI_OBJ) $(EVENTS_OBJ) $(RESOURCES_OBJ) $(INPUT_OBJ) $(SCRIPTING_OBJ)
$(LD) $(INCLUDES) $^ -o $@ $(LDFLAGS)
dummy_main_resources: dummy_main_resources.cpp $(RESOURCES_OBJ)
$(LD) $(INCLUDES) $^ -o $@ $(LDFLAGS)
# build/events/%.o: %.cpp
# $(CC) $(CXXFLAGS) $(INCLUDES) -c $$< -o $$@
$(foreach bdir,$(BUILD_DIR),$(eval $(call make-goal,$(bdir))))
clean:
rm $(OBJ)