forked from turbulenz/turbulenz_engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
236 lines (187 loc) · 6.9 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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
BUILDDIR := external/tzbuild
ifeq (,$(wildcard $(BUILDDIR)/config.mk))
$(error Have you updated all submodules to include tzbuild?)
endif
include $(BUILDDIR)/config.mk
# $(warning TARGET=$(TARGET))
# $(warning TARGETNAME=$(TARGETNAME))
# $(warning CONFIG=$(CONFIG))
# $(warning MAKEFLAGS=$(MAKEFLAGS))
# $(warning MAKECMDGOALS=$(MAKECMDGOALS))
############################################################
help:
@echo ""
@echo "Usage:"
@echo ""
@echo " make [<flags>] <targets>"
@echo ""
@echo "Targets:"
@echo ""
@echo "jslib"
############################################################
# TSLIB build modules
############################################################
TSC := tsc
MODULAR ?= 0
REFCHECK ?= 0
ONESHOT ?= 0
TS_MODULAR ?= $(MODULAR)
TS_REFCHECK ?= $(REFCHECK)
TS_ONESHOT ?= $(ONESHOT)
TS_OUTPUT_DIR := jslib$(if $(filter $(MODULAR),1),-modular)
TS_OUTPUT_DIR := $(TS_OUTPUT_DIR)$(if $(filter $(REFCHECK),1),-refcheck)
TS_SRC_DIR := tslib
ifeq (win32,$(BUILDHOST))
CGFX2JSON ?= tools\bin\$(BUILDHOST)\cgfx2json.exe
else
CGFX2JSON ?= tools/bin/$(BUILDHOST)/cgfx2json
endif
CGFX2JSONFLAGS := -j 4
# platform
platform_src := $(TS_SRC_DIR)/base.d.ts $(TS_SRC_DIR)/turbulenz.d.ts
# debug
debug_src := $(TS_SRC_DIR)/debug.ts
debug_deps := platform
# vmath
vmath_src := $(TS_SRC_DIR)/vmath.ts
vmath_deps := platform debug
# AABBTree
aabbtree_src := $(TS_SRC_DIR)/aabbtree.ts
aabbtree_deps := vmath debug
# physics_canvas
physics_canvas_src := $(TS_SRC_DIR)/webgl/physicsdevice.ts
physics_canvas_deps := aabbtree vmath platform
physics_canvas_nodecls := 1
# platform_canvas - everything in webgl except the physicsdevice
platform_canvas_src := \
$(filter-out %physicsdevice.ts,$(wildcard $(TS_SRC_DIR)/webgl/*.ts))
platform_canvas_deps := vmath platform
platform_canvas_nodecls := 1
# utilities
utilities_src = $(addprefix $(TS_SRC_DIR)/, \
observer.ts requesthandler.ts utilities.ts)
utilities_deps := platform
# servicestypes
servicedatatypes_src := $(TS_SRC_DIR)/services/servicedatatypes.d.ts
# services
services_src := $(wildcard $(TS_SRC_DIR)/services/*.ts)
services_deps := utilities debug servicedatatypes
# tzdraw2d
tzdraw2d_src := $(TS_SRC_DIR)/draw2d.ts assets/shaders/draw2D.cgfx
tzdraw2d_deps = platform debug
# physics2d
physics2d_src := $(TS_SRC_DIR)/physics2ddevice.ts $(TS_SRC_DIR)/boxtree.ts
physics2d_deps := platform debug
# physics2ddebugdraw
physics2ddebugdraw_src := \
$(TS_SRC_DIR)/physics2ddebugdraw.ts assets/shaders/debugphys2d.cgfx
physics2ddebugdraw_deps := physics2d
# fontmanager
fontmanager_src := $(TS_SRC_DIR)/fontmanager.ts
fontmanager_deps := platform utilities debug
# canvas
canvas_src := $(TS_SRC_DIR)/canvas.ts assets/shaders/canvas.cgfx
canvas_deps := platform fontmanager
# svg
svg_src := $(TS_SRC_DIR)/svg.ts
svg_deps := canvas
# spatialgrid
spatialgrid_src := $(TS_SRC_DIR)/spatialgrid.ts
spatialgrid_deps := debug
# sparsegrid
sparsegrid_src := $(TS_SRC_DIR)/sparsegrid.ts
sparsegrid_deps := debug
# jsengine_base
jsengine_base_src := $(addprefix $(TS_SRC_DIR)/, \
assetcache.ts assettracker.ts camera.ts charactercontroller.ts \
indexbuffermanager.ts soundmanager.ts texturemanager.ts \
vertexbuffermanager.ts)
jsengine_base_deps := platform utilities debug
# shadermanager
shadermanager_src := $(TS_SRC_DIR)/shadermanager.ts assets/shaders/default.cgfx
shadermanager_deps := jsengine_base
# jsengine
jsengine_src := $(addprefix $(TS_SRC_DIR)/, \
animation.ts animationmanager.ts defaultrendering.ts effectmanager.ts \
material.ts geometry.ts light.ts mouseforces.ts physicsmanager.ts \
posteffects.ts renderingcommon.ts resourceloader.ts scene.ts scenenode.ts \
shadowmapping.ts cascadedshadows.ts \
)
jsengine_deps := services aabbtree jsengine_base shadermanager
# floor
floor_src := $(TS_SRC_DIR)/floor.ts assets/shaders/floor.cgfx
floor_deps := jsengine_base
# loadingscreen
loadingscreen_src := \
$(TS_SRC_DIR)/loadingscreen.ts assets/shaders/loadingscreen.cgfx
loadingscreen_deps := jsengine_base
# textureeffects
textureeffects_src := \
$(TS_SRC_DIR)/textureeffects.ts assets/shaders/textureeffects.cgfx
textureeffects_deps := jsengine_base
# jsengine_simplerendering
jsengine_simplerendering_src := $(TS_SRC_DIR)/simplerendering.ts
jsengine_simplerendering_deps := jsengine
# jsengine_deferredrendering
jsengine_deferredrendering_src := $(TS_SRC_DIR)/deferredrendering.ts
jsengine_deferredrendering_deps := jsengine
# jsengine_forwardrendering
jsengine_forwardrendering_src := $(TS_SRC_DIR)/forwardrendering.ts
jsengine_forwardrendering_deps := jsengine
# jsengine_debug
jsengine_debug_src := $(addprefix $(TS_SRC_DIR)/, \
drawprimitives.ts debuggingtools.ts networklatencysimulator.ts \
scenedebugging.ts) \
$(wildcard $(TS_SRC_DIR)/dump*.ts)
jsengine_debug_deps := jsengine
# capturedevices
capturedevices_src := tslib/capturegraphicsdevice.ts
capturedevices_deps := platform debug
# particlesystem
particlesystem_src := tslib/particlesystem.ts \
assets/shaders/particles-copy.cgfx \
assets/shaders/particles-packer.cgfx \
assets/shaders/particles-sort.cgfx
particlesystem_deps := platform debug jsengine
TSLIBS += platform debug vmath aabbtree physics_canvas platform_canvas \
utilities services tzdraw2d physics2d physics2ddebugdraw fontmanager canvas \
jsengine_base shadermanager floor loadingscreen textureeffects jsengine \
jsengine_simplerendering jsengine_deferredrendering \
jsengine_forwardrendering jsengine_debug capturedevices svg spatialgrid \
particlesystem sparsegrid
# Check we haven't forgotten any tslib files
ifeq (macosx,$(TARGET))
all_ts_files := $(shell find tslib -iname '[^\.]*.ts' | grep -v external)
all_ts_src_files := \
$(TS_BASE_FILES) $(foreach tsl,$(TSLIBS),$($(tsl)_src))
forgotten_ts_files := $(filter-out $(all_ts_src_files),$(all_ts_files))
ifneq (,$(forgotten_ts_files))
$(error THESE FILES ARE NOT USED: $(forgotten_ts_files))
endif
endif
############################################################
# Temporary hack to prevent C rules being included since they don't
# work under pymake.
ifeq (jslib,$(MAKECMDGOALS))
APPS:=
LIBS:=
DLLS:=
endif
# EXT, LIBS, APPS are used to set up all build rules ...
include $(BUILDDIR)/rules.mk
############################################################
# Single file with all code
############################################################
ifeq (1,$(TS_MODULAR))
UGLIFY := node $(BUILDDIR)/../uglifyjs/bin/uglifyjs
AIO_ALL_INPUT := $(foreach t,$(TSLIBS),$(_$(t)_out_js))
turbulenz-all-min.js : $(AIO_ALL_INPUT)
$(CMDPREFIX)$(CAT) $^ | $(UGLIFY) -o $@
AIO_ALL_DECLS := $(foreach t,$(TSLIBS), \
$(if $($(t)_nodecls),,$(_$(t)_out_d_ts)) \
)
turbulenz-all.d.ts : $(AIO_ALL_DECLS)
$(CAT) $^ > $@
.PHONY: allinone
allinone : turbulenz-all-min.js turbulenz-all.d.ts
endif