forked from solidi/vhlt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
358 lines (299 loc) · 9.14 KB
/
Makefile
File metadata and controls
358 lines (299 loc) · 9.14 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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#
# Makefile for Linux GNU compiler
#
# Usage:
# make - Build all tools. They will be copied into 'bin' directory.
# make clean - Clean.
# make hlcsg - Build hlcsg.
# make hlbsp - Build hlbsp.
# make hlvis - Build hlvis.
# make hlrad - Build hlrad.
# make ripent - Build ripent.
#
# Before running the tools, please make sure the default maximum stack size on your computer
# is more than 4MB.
#
# When compiling with g++:
# Flag '-fno-strict-aliasing' is a must.
# All macro definitions should not be changed, because all code were written and checked under this assumption.
# The following warnings should be ignored:
# warning: no newline at end of file
# warning: '???' may be used uninitialized in this function
# warning: suggest parentheses around assignment used as truth value
# warning: passing ‘float’ for argument 1 to ‘void seconds_to_hhmm(unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&)’
# warning: ignoring #pragma warning
# warning: comparison between signed and unsigned integer expressions
# warning: enumeration value ‘???’ not handled in switch
# warning: unused variable ‘???’
# warning: converting to ‘int’ from ‘vec_t’
#
CXX?=g++
#
# Common .cpp and .h files for all projects
#
COMMON_CPPFILES = \
common/blockmem.cpp \
common/bspfile.cpp \
common/cmdlib.cpp \
common/cmdlinecfg.cpp \
common/filelib.cpp \
common/log.cpp \
common/mathlib.cpp \
common/messages.cpp \
common/scriplib.cpp \
common/threads.cpp \
common/winding.cpp \
COMMON_INCLUDEDIRS = \
template \
common \
COMMON_INCLUDEFILES = \
template/basictypes.h \
common/blockmem.h \
common/boundingbox.h \
common/bspfile.h \
common/cmdlib.h \
common/cmdlinecfg.h \
common/filelib.h \
common/hlassert.h \
common/log.h \
common/mathlib.h \
common/mathtypes.h \
common/messages.h \
common/scriplib.h \
common/threads.h \
common/win32fix.h \
common/winding.h \
ifeq ($(CXX),x86_64-w64-mingw32-g++)
HLCSG_NAME = hlcsg.exe
HLBSP_NAME = hlbsp.exe
HLRAD_NAME = hlrad.exe
HLVIS_NAME = hlvis.exe
RIPENT_NAME = ripent.exe
COMMON_DEFINITIONS = \
VERSION_64BIT \
NDEBUG \
WIN32 \
_CONSOLE \
SYSTEM_WIN32 \
STDC_HEADERS
else ifeq ($(CXX),i686-w64-mingw32-g++)
HLCSG_NAME = hlcsg.exe
HLBSP_NAME = hlbsp.exe
HLRAD_NAME = hlrad.exe
HLVIS_NAME = hlvis.exe
RIPENT_NAME = ripent.exe
COMMON_DEFINITIONS = \
VERSION_32BIT \
NDEBUG \
WIN32 \
_CONSOLE \
SYSTEM_WIN32 \
STDC_HEADERS
else
HLCSG_NAME = hlcsg
HLBSP_NAME = hlbsp
HLRAD_NAME = hlrad
HLVIS_NAME = hlvis
RIPENT_NAME = ripent
COMMON_DEFINITIONS = \
VERSION_LINUX \
SYSTEM_POSIX \
NDEBUG \
STDC_HEADERS \
HAVE_FCNTL_H \
HAVE_PTHREAD_H \
HAVE_SYS_RESOURCE_H \
HAVE_SYS_STAT_H \
HAVE_SYS_TIME_H \
HAVE_UNISTD_H
endif
COMMON_FLAGS = -Wall -Wno-deprecated-declarations -O2 -fno-strict-aliasing -pthread -pipe $(USER_FLAGS)
#
# Specific .cpp and .h files for hlcsg, hlbsp, hlvis, hlrad and ripent
#
HLCSG_CPPFILES = \
$(COMMON_CPPFILES) \
hlcsg/ansitoutf8.cpp \
hlcsg/autowad.cpp \
hlcsg/brush.cpp \
hlcsg/brushunion.cpp \
hlcsg/hullfile.cpp \
hlcsg/map.cpp \
hlcsg/properties.cpp \
hlcsg/qcsg.cpp \
hlcsg/textures.cpp \
hlcsg/wadcfg.cpp \
hlcsg/wadinclude.cpp \
hlcsg/wadpath.cpp \
HLCSG_INCLUDEDIRS = \
$(COMMON_INCLUDEDIRS) \
hlcsg \
HLCSG_INCLUDEFILES = \
$(COMMON_INCLUDEFILES) \
hlcsg/csg.h \
hlcsg/wadpath.h \
HLCSG_DEFINITIONS = \
$(COMMON_DEFINITIONS) \
HLCSG \
DOUBLEVEC_T \
HLBSP_CPPFILES = \
$(COMMON_CPPFILES) \
hlbsp/brink.cpp \
hlbsp/merge.cpp \
hlbsp/outside.cpp \
hlbsp/portals.cpp \
hlbsp/qbsp.cpp \
hlbsp/solidbsp.cpp \
hlbsp/surfaces.cpp \
hlbsp/tjunc.cpp \
hlbsp/writebsp.cpp \
HLBSP_INCLUDEDIRS = \
$(COMMON_INCLUDEDIRS) \
hlbsp \
HLBSP_INCLUDEFILES = \
$(COMMON_INCLUDEFILES) \
hlbsp/bsp5.h \
HLBSP_DEFINITIONS = \
$(COMMON_DEFINITIONS) \
HLBSP \
DOUBLEVEC_T \
HLVIS_CPPFILES = \
$(COMMON_CPPFILES) \
hlvis/flow.cpp \
hlvis/vis.cpp \
hlvis/zones.cpp \
HLVIS_INCLUDEDIRS = \
$(COMMON_INCLUDEDIRS) \
hlvis \
HLVIS_INCLUDEFILES = \
$(COMMON_INCLUDEFILES) \
hlvis/vis.h \
hlvis/zones.h \
HLVIS_DEFINITIONS = \
$(COMMON_DEFINITIONS) \
HLVIS \
HLRAD_CPPFILES = \
$(COMMON_CPPFILES) \
hlrad/compress.cpp \
hlrad/lerp.cpp \
hlrad/lightmap.cpp \
hlrad/loadtextures.cpp \
hlrad/mathutil.cpp \
hlrad/nomatrix.cpp \
hlrad/qrad.cpp \
hlrad/qradutil.cpp \
hlrad/sparse.cpp \
hlrad/trace.cpp \
hlrad/transfers.cpp \
hlrad/transparency.cpp \
hlrad/vismatrix.cpp \
hlrad/vismatrixutil.cpp \
HLRAD_INCLUDEDIRS = \
$(COMMON_INCLUDEDIRS) \
hlrad \
HLRAD_INCLUDEFILES = \
$(COMMON_INCLUDEFILES) \
common/anorms.h \
hlrad/compress.h \
hlrad/qrad.h \
HLRAD_DEFINITIONS = \
$(COMMON_DEFINITIONS) \
HLRAD \
RIPENT_CPPFILES = \
$(COMMON_CPPFILES) \
ripent/ripent.cpp \
RIPENT_INCLUDEDIRS = \
$(COMMON_INCLUDEDIRS) \
ripent \
RIPENT_INCLUDEFILES = \
$(COMMON_INCLUDEFILES) \
ripent/ripent.h \
RIPENT_DEFINITIONS = \
$(COMMON_DEFINITIONS) \
RIPENT \
#
# Build commands
#
.PHONY : all
all : bin/hlcsg bin/hlbsp bin/hlvis bin/hlrad bin/ripent printusage
@echo ======== OK ========
.PHONY : hlcsg
hlcsg : bin/hlcsg printusage
@echo ======== OK ========
.PHONY : hlbsp
hlbsp : bin/hlbsp printusage
@echo ======== OK ========
.PHONY : hlvis
hlvis : bin/hlvis printusage
@echo ======== OK ========
.PHONY : hlrad
hlrad : bin/hlrad printusage
@echo ======== OK ========
.PHONY : ripent
ripent : bin/ripent printusage
@echo ======== OK ========
bin/hlcsg : $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) printusage
@echo ======== hlcsg : linking ========
mkdir -p hlcsg/release/bin
$(CXX) $(COMMON_FLAGS) -o hlcsg/release/bin/hlcsg $(addprefix -I,$(HLCSG_INCLUDEDIRS)) $(addprefix -D,$(HLCSG_DEFINITIONS)) $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o)
mkdir -p bin
cp hlcsg/release/bin/$(HLCSG_NAME) bin/$(HLCSG_NAME)
$(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) : hlcsg/release/%.o : %.cpp $(HLCSG_INCLUDEFILES) printusage
@echo ======== hlcsg : compiling $< ========
mkdir -p $(dir $@)
$(CXX) -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLCSG_INCLUDEDIRS)) $(addprefix -D,$(HLCSG_DEFINITIONS)) $<
bin/hlbsp : $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) printusage
@echo ======== hlbsp : linking ========
mkdir -p hlbsp/release/bin
$(CXX) $(COMMON_FLAGS) -o hlbsp/release/bin/hlbsp $(addprefix -I,$(HLBSP_INCLUDEDIRS)) $(addprefix -D,$(HLBSP_DEFINITIONS)) $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o)
mkdir -p bin
cp hlbsp/release/bin/$(HLBSP_NAME) bin/$(HLBSP_NAME)
$(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) : hlbsp/release/%.o : %.cpp $(HLBSP_INCLUDEFILES) printusage
@echo ======== hlbsp : compiling $< ========
mkdir -p $(dir $@)
$(CXX) -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLBSP_INCLUDEDIRS)) $(addprefix -D,$(HLBSP_DEFINITIONS)) $<
bin/hlvis : $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) printusage
@echo ======== hlvis : linking ========
mkdir -p hlvis/release/bin
$(CXX) $(COMMON_FLAGS) -o hlvis/release/bin/hlvis $(addprefix -I,$(HLVIS_INCLUDEDIRS)) $(addprefix -D,$(HLVIS_DEFINITIONS)) $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o)
mkdir -p bin
cp hlvis/release/bin/$(HLVIS_NAME) bin/$(HLVIS_NAME)
$(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) : hlvis/release/%.o : %.cpp $(HLVIS_INCLUDEFILES) printusage
@echo ======== hlvis : compiling $< ========
mkdir -p $(dir $@)
$(CXX) -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLVIS_INCLUDEDIRS)) $(addprefix -D,$(HLVIS_DEFINITIONS)) $<
bin/hlrad : $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) printusage
@echo ======== hlrad : linking ========
mkdir -p hlrad/release/bin
$(CXX) $(COMMON_FLAGS) -o hlrad/release/bin/hlrad $(addprefix -I,$(HLRAD_INCLUDEDIRS)) $(addprefix -D,$(HLRAD_DEFINITIONS)) $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o)
mkdir -p bin
cp hlrad/release/bin/$(HLRAD_NAME) bin/$(HLRAD_NAME)
$(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) : hlrad/release/%.o : %.cpp $(HLRAD_INCLUDEFILES) printusage
@echo ======== hlrad : compiling $< ========
mkdir -p $(dir $@)
$(CXX) -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLRAD_INCLUDEDIRS)) $(addprefix -D,$(HLRAD_DEFINITIONS)) $<
bin/ripent : $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) printusage
@echo ======== ripent : linking ========
mkdir -p ripent/release/bin
$(CXX) $(COMMON_FLAGS) -o ripent/release/bin/ripent $(addprefix -I,$(RIPENT_INCLUDEDIRS)) $(addprefix -D,$(RIPENT_DEFINITIONS)) $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o)
mkdir -p bin
cp ripent/release/bin/$(RIPENT_NAME) bin/$(RIPENT_NAME)
$(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) : ripent/release/%.o : %.cpp $(RIPENT_INCLUDEFILES) printusage
@echo ======== ripent : compiling $< ========
mkdir -p $(dir $@)
$(CXX) -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(RIPENT_INCLUDEDIRS)) $(addprefix -D,$(RIPENT_DEFINITIONS)) $<
.PHONY : printusage
printusage :
head -n 35 Makefile
#
# Clean
#
.PHONY : clean
clean : printusage
rm -rf hlcsg/release
rm -rf hlbsp/release
rm -rf hlvis/release
rm -rf hlrad/release
rm -rf ripent/release
rm -rf bin
@echo ======== OK ========