forked from vayerx/shadowgrounds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.mk
150 lines (103 loc) · 4.74 KB
/
module.mk
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
.PHONY: default all bindirs clean combine partial
TARGETS:=survivor$(EXESUFFIX) shadowgrounds$(EXESUFFIX)
default: all
all: $(TARGETS)
combine: survivor-combine$(EXESUFFIX) shadowgrounds-combine$(EXESUFFIX)
partial: survivor-partial.o
CXXFLAGS+=-I$(TOPDIR) -I$(TOPDIR)/storm/include -I$(TOPDIR)/storm/keyb3
# rules here
%.sg.o: %.cpp
$(CXX) -c -include $(TOPDIR)/shadowgrounds/configuration.h -DPROJECT_SHADOWGROUNDS -I$(TOPDIR)/shadowgrounds -MT$@ -MF $*.sg.d -MMD $(CXXFLAGS) $(INCLUDES) -o $@ $<
# $(CXX) -c -DHACKY_SG_AMBIENT_LIGHT_FIX -include $(TOPDIR)/shadowgrounds/configuration.h -DPROJECT_SHADOWGROUNDS -I$(TOPDIR)/shadowgrounds -MT$@ -MF $*.sg.d -MMD $(CXXFLAGS) $(INCLUDES) -o $@ $<
%.sv.o: %.cpp
$(CXX) -c -include $(TOPDIR)/survivor/configuration.h -DPROJECT_SURVIVOR -I$(TOPDIR)/survivor -MT$@ -MF $*.sv.d -MMD $(CXXFLAGS) $(INCLUDES) -o $@ $<
CLEANDIRS:=
#unfortunately this doesn't work
#dirs:=container convert filesystem game ogui physics physics_ode shadowgrounds sound storm system ui util
#$(foreach dir, $(dirs), include $(dir)/module.mk)
dir:=container
include $(TOPDIR)/$(dir)/module.mk
dir:=convert
include $(TOPDIR)/$(dir)/module.mk
dir:=editor
include $(TOPDIR)/$(dir)/module.mk
dir:=filesystem
include $(TOPDIR)/$(dir)/module.mk
dir:=game
include $(TOPDIR)/$(dir)/module.mk
dir:=ogui
include $(TOPDIR)/$(dir)/module.mk
dir:=particle_editor2
include $(TOPDIR)/$(dir)/module.mk
dir:=physics
include $(TOPDIR)/$(dir)/module.mk
dir:=ui
include $(TOPDIR)/$(dir)/module.mk
dir:=util
include $(TOPDIR)/$(dir)/module.mk
dir:=shadowgrounds
include $(TOPDIR)/$(dir)/module.mk
dir:=sound
include $(TOPDIR)/$(dir)/module.mk
dir:=storm
include $(TOPDIR)/$(dir)/module.mk
dir:=survivor
include $(TOPDIR)/$(dir)/module.mk
dir:=system
include $(TOPDIR)/$(dir)/module.mk
clean:
rm -f $(TARGETS) $(foreach dir,$(CLEANDIRS),$(dir)/*.o) $(foreach dir,$(CLEANDIRS),$(dir)/*.d) *-combine.cpp
# create directories which might contain object files
bindirs:
mkdir -p $(CLEANDIRS)
shadowgrounds_modules:=container convert editor filesystem game ogui \
particlesystem shadowgrounds sound \
system ui util storm
survivor_modules:=container convert editor filesystem game ogui \
particlesystem survivor sound \
system ui util storm
ifeq ($(PHYSX),y)
CXXFLAGS+=-DPHYSICS_PHYSX
CXXFLAGS+=$(IPHYSX)
LDLIBS+=$(LPHYSX)
shadowgrounds_modules+=physics
survivor_modules+=physics
else
CXXFLAGS+=-DPHYSICS_NONE
endif
ifeq ($(LIBAVCODEC),y)
CXXFLAGS+=$(IAVCODEC) -DUSE_LIBAVCODEC
LDLIBS:=$(LAVCODEC) $(LDLIBS)
endif
shadowgrounds_SRC:=$(foreach mod,$(shadowgrounds_modules),$(SRC_$(mod))) storm/keyb3/keyb.cpp ui/TacticalUnitWindow.cpp
shadowgrounds_OBJS:=$(shadowgrounds_SRC:.cpp=.sg.o)
survivor_SRC:=$(foreach mod,$(survivor_modules),$(SRC_$(mod))) storm/keyb3/keyb.cpp $(SRC_survivorui) game/BonusManager.cpp
survivor_OBJS:=$(survivor_SRC:.cpp=.sv.o)
-include $(shadowgrounds_SRC:.cpp=.sg.d)
-include $(survivor_SRC:.cpp=.sv.d)
storm-combine.cpp: $(filter-out storm/storm3dv2/Storm3D_Mesh_CollisionTable.cpp,$(storm_SRC))
@echo Generating $@
@../gencombine.sh $@ $^
#Storm3D_Mesh_CollisionTable.o must be compiled unoptimized
# gcc bug?
storm/storm3dv2/Storm3D_Mesh_CollisionTable.sv.o: CXXFLAGS+=-O0
storm/storm3dv2/Storm3D_Mesh_CollisionTable.sg.o: CXXFLAGS+=-O0
util/LipsyncManager.sv.o: CXXFLAGS+=-O0
#survivor-combine.cpp: $(filter-out storm/storm3dv2/Storm3D_Mesh_CollisionTable.cpp,$(foreach mod,$(survivor_modules) $(storm_modules),$(SRC_$(mod))) $(SRC_survivorui) game/BonusManager.cpp storm/keyb3/keyb.cpp)
survivor-combine.cpp: $(foreach mod,$(survivor_modules),$(SRC_$(mod))) $(SRC_survivorui) game/BonusManager.cpp
@echo Generating $@
@../gencombine.sh $@ $^
survivor-combine$(EXESUFFIX): survivor-combine.cpp
$(CXX) -fwhole-program -DCOMBINE -include $(TOPDIR)/survivor/configuration.h -DPROJECT_SURVIVOR -I$(TOPDIR)/survivor $(CXXFLAGS) $(INCLUDES) -o $@ $^ $(LDFLAGS) $(LDLIBS)
#shadowgrounds-combine.cpp: $(filter-out storm/storm3dv2/Storm3D_Mesh_CollisionTable.cpp,$(foreach mod,$(shadowgrounds_modules) $(storm_modules),$(SRC_$(mod))) storm/keyb3/keyb.cpp ui/TacticalUnitWindow.cpp)
shadowgrounds-combine.cpp: $(foreach mod,$(shadowgrounds_modules),$(SRC_$(mod))) ui/TacticalUnitWindow.cpp
@echo Generating $@
@../gencombine.sh $@ $^
shadowgrounds-combine$(EXESUFFIX): shadowgrounds-combine.cpp
$(CXX) -fwhole-program -DCOMBINE -include $(TOPDIR)/shadowgrounds/configuration.h -DPROJECT_SHADOWGROUNDS -I$(TOPDIR)/shadowgrounds $(CXXFLAGS) $(INCLUDES) -o $@ $^ $(LDFLAGS) $(LDLIBS)
shadowgrounds$(EXESUFFIX): $(shadowgrounds_OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
survivor$(EXESUFFIX): $(survivor_OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
survivor-partial.o: $(survivor_OBJS)
ld -Ur -o $@ $^