|
| 1 | + |
| 2 | +# |
| 3 | +# Makefile for Linux GNU compiler |
| 4 | +# |
| 5 | +# Usage: |
| 6 | +# make - Build all tools. They will be copied into 'bin' directory. |
| 7 | +# make clean - Clean. |
| 8 | +# make hlcsg - Build hlcsg. |
| 9 | +# make hlbsp - Build hlbsp. |
| 10 | +# make hlvis - Build hlvis. |
| 11 | +# make hlrad - Build hlrad. |
| 12 | +# make ripent - Build ripent. |
| 13 | +# |
| 14 | +# Before running the tools, please make sure the default maximum stack size on your computer |
| 15 | +# is more than 4MB. |
| 16 | +# |
| 17 | +# When compiling with g++: |
| 18 | +# Flag '-fno-strict-aliasing' is a must. |
| 19 | +# All macro definitions should not be changed, because all code were written and checked under this assumption. |
| 20 | +# The following warnings should be ignored: |
| 21 | +# warning: no newline at end of file |
| 22 | +# warning: '???' may be used uninitialized in this function |
| 23 | +# warning: suggest parentheses around assignment used as truth value |
| 24 | +# warning: passing ‘float’ for argument 1 to ‘void seconds_to_hhmm(unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&)’ |
| 25 | +# warning: ignoring #pragma warning |
| 26 | +# warning: comparison between signed and unsigned integer expressions |
| 27 | +# warning: enumeration value ‘???’ not handled in switch |
| 28 | +# warning: unused variable ‘???’ |
| 29 | +# warning: converting to ‘int’ from ‘vec_t’ |
| 30 | +# |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +# |
| 40 | +# Common .cpp and .h files for all projects |
| 41 | +# |
| 42 | + |
| 43 | +COMMON_CPPFILES = \ |
| 44 | + common/blockmem.cpp \ |
| 45 | + common/bspfile.cpp \ |
| 46 | + common/cmdlib.cpp \ |
| 47 | + common/cmdlinecfg.cpp \ |
| 48 | + common/filelib.cpp \ |
| 49 | + common/log.cpp \ |
| 50 | + common/mathlib.cpp \ |
| 51 | + common/messages.cpp \ |
| 52 | + common/scriplib.cpp \ |
| 53 | + common/threads.cpp \ |
| 54 | + common/winding.cpp \ |
| 55 | + |
| 56 | +COMMON_INCLUDEDIRS = \ |
| 57 | + template \ |
| 58 | + common \ |
| 59 | + |
| 60 | +COMMON_INCLUDEFILES = \ |
| 61 | + template/basictypes.h \ |
| 62 | + common/blockmem.h \ |
| 63 | + common/boundingbox.h \ |
| 64 | + common/bspfile.h \ |
| 65 | + common/cmdlib.h \ |
| 66 | + common/cmdlinecfg.h \ |
| 67 | + common/filelib.h \ |
| 68 | + common/hlassert.h \ |
| 69 | + common/log.h \ |
| 70 | + common/mathlib.h \ |
| 71 | + common/mathtypes.h \ |
| 72 | + common/messages.h \ |
| 73 | + common/scriplib.h \ |
| 74 | + common/threads.h \ |
| 75 | + common/win32fix.h \ |
| 76 | + common/winding.h \ |
| 77 | + |
| 78 | +COMMON_DEFINITIONS = \ |
| 79 | + VERSION_LINUX \ |
| 80 | + SYSTEM_POSIX \ |
| 81 | + NDEBUG \ |
| 82 | + STDC_HEADERS \ |
| 83 | + HAVE_FCNTL_H \ |
| 84 | + HAVE_PTHREAD_H \ |
| 85 | + HAVE_SYS_RESOURCE_H \ |
| 86 | + HAVE_SYS_STAT_H \ |
| 87 | + HAVE_SYS_TIME_H \ |
| 88 | + HAVE_UNISTD_H \ |
| 89 | + |
| 90 | +COMMON_FLAGS = -Wall -O2 -fno-strict-aliasing -pthread -pipe |
| 91 | + |
| 92 | +# |
| 93 | +# Specific .cpp and .h files for hlcsg, hlbsp, hlvis, hlrad and ripent |
| 94 | +# |
| 95 | + |
| 96 | +HLCSG_CPPFILES = \ |
| 97 | + $(COMMON_CPPFILES) \ |
| 98 | + hlcsg/ansitoutf8.cpp \ |
| 99 | + hlcsg/autowad.cpp \ |
| 100 | + hlcsg/brush.cpp \ |
| 101 | + hlcsg/brushunion.cpp \ |
| 102 | + hlcsg/hullfile.cpp \ |
| 103 | + hlcsg/map.cpp \ |
| 104 | + hlcsg/properties.cpp \ |
| 105 | + hlcsg/qcsg.cpp \ |
| 106 | + hlcsg/textures.cpp \ |
| 107 | + hlcsg/wadcfg.cpp \ |
| 108 | + hlcsg/wadinclude.cpp \ |
| 109 | + hlcsg/wadpath.cpp \ |
| 110 | + |
| 111 | +HLCSG_INCLUDEDIRS = \ |
| 112 | + $(COMMON_INCLUDEDIRS) \ |
| 113 | + hlcsg \ |
| 114 | + |
| 115 | +HLCSG_INCLUDEFILES = \ |
| 116 | + $(COMMON_INCLUDEFILES) \ |
| 117 | + hlcsg/csg.h \ |
| 118 | + hlcsg/wadpath.h \ |
| 119 | + |
| 120 | +HLCSG_DEFINITIONS = \ |
| 121 | + $(COMMON_DEFINITIONS) \ |
| 122 | + HLCSG \ |
| 123 | + DOUBLEVEC_T \ |
| 124 | + |
| 125 | +HLBSP_CPPFILES = \ |
| 126 | + $(COMMON_CPPFILES) \ |
| 127 | + hlbsp/brink.cpp \ |
| 128 | + hlbsp/merge.cpp \ |
| 129 | + hlbsp/outside.cpp \ |
| 130 | + hlbsp/portals.cpp \ |
| 131 | + hlbsp/qbsp.cpp \ |
| 132 | + hlbsp/solidbsp.cpp \ |
| 133 | + hlbsp/surfaces.cpp \ |
| 134 | + hlbsp/tjunc.cpp \ |
| 135 | + hlbsp/writebsp.cpp \ |
| 136 | + |
| 137 | +HLBSP_INCLUDEDIRS = \ |
| 138 | + $(COMMON_INCLUDEDIRS) \ |
| 139 | + hlbsp \ |
| 140 | + |
| 141 | +HLBSP_INCLUDEFILES = \ |
| 142 | + $(COMMON_INCLUDEFILES) \ |
| 143 | + hlbsp/bsp5.h \ |
| 144 | + |
| 145 | +HLBSP_DEFINITIONS = \ |
| 146 | + $(COMMON_DEFINITIONS) \ |
| 147 | + HLBSP \ |
| 148 | + DOUBLEVEC_T \ |
| 149 | + |
| 150 | +HLVIS_CPPFILES = \ |
| 151 | + $(COMMON_CPPFILES) \ |
| 152 | + hlvis/flow.cpp \ |
| 153 | + hlvis/vis.cpp \ |
| 154 | + hlvis/zones.cpp \ |
| 155 | + |
| 156 | +HLVIS_INCLUDEDIRS = \ |
| 157 | + $(COMMON_INCLUDEDIRS) \ |
| 158 | + hlvis \ |
| 159 | + |
| 160 | +HLVIS_INCLUDEFILES = \ |
| 161 | + $(COMMON_INCLUDEFILES) \ |
| 162 | + hlvis/vis.h \ |
| 163 | + hlvis/zones.h \ |
| 164 | + |
| 165 | +HLVIS_DEFINITIONS = \ |
| 166 | + $(COMMON_DEFINITIONS) \ |
| 167 | + HLVIS \ |
| 168 | + |
| 169 | +HLRAD_CPPFILES = \ |
| 170 | + $(COMMON_CPPFILES) \ |
| 171 | + hlrad/compress.cpp \ |
| 172 | + hlrad/lerp.cpp \ |
| 173 | + hlrad/lightmap.cpp \ |
| 174 | + hlrad/loadtextures.cpp \ |
| 175 | + hlrad/mathutil.cpp \ |
| 176 | + hlrad/nomatrix.cpp \ |
| 177 | + hlrad/qrad.cpp \ |
| 178 | + hlrad/qradutil.cpp \ |
| 179 | + hlrad/sparse.cpp \ |
| 180 | + hlrad/trace.cpp \ |
| 181 | + hlrad/transfers.cpp \ |
| 182 | + hlrad/transparency.cpp \ |
| 183 | + hlrad/vismatrix.cpp \ |
| 184 | + hlrad/vismatrixutil.cpp \ |
| 185 | + |
| 186 | +HLRAD_INCLUDEDIRS = \ |
| 187 | + $(COMMON_INCLUDEDIRS) \ |
| 188 | + hlrad \ |
| 189 | + |
| 190 | +HLRAD_INCLUDEFILES = \ |
| 191 | + $(COMMON_INCLUDEFILES) \ |
| 192 | + common/anorms.h \ |
| 193 | + hlrad/compress.h \ |
| 194 | + hlrad/qrad.h \ |
| 195 | + |
| 196 | +HLRAD_DEFINITIONS = \ |
| 197 | + $(COMMON_DEFINITIONS) \ |
| 198 | + HLRAD \ |
| 199 | + |
| 200 | +RIPENT_CPPFILES = \ |
| 201 | + $(COMMON_CPPFILES) \ |
| 202 | + ripent/ripent.cpp \ |
| 203 | + |
| 204 | +RIPENT_INCLUDEDIRS = \ |
| 205 | + $(COMMON_INCLUDEDIRS) \ |
| 206 | + ripent \ |
| 207 | + |
| 208 | +RIPENT_INCLUDEFILES = \ |
| 209 | + $(COMMON_INCLUDEFILES) \ |
| 210 | + ripent/ripent.h \ |
| 211 | + |
| 212 | +RIPENT_DEFINITIONS = \ |
| 213 | + $(COMMON_DEFINITIONS) \ |
| 214 | + RIPENT \ |
| 215 | + |
| 216 | +# |
| 217 | +# Build commands |
| 218 | +# |
| 219 | + |
| 220 | +.PHONY : all |
| 221 | +all : bin/hlcsg bin/hlbsp bin/hlvis bin/hlrad bin/ripent printusage |
| 222 | + @echo ======== OK ======== |
| 223 | + |
| 224 | +.PHONY : hlcsg |
| 225 | +hlcsg : bin/hlcsg printusage |
| 226 | + @echo ======== OK ======== |
| 227 | + |
| 228 | +.PHONY : hlbsp |
| 229 | +hlbsp : bin/hlbsp printusage |
| 230 | + @echo ======== OK ======== |
| 231 | + |
| 232 | +.PHONY : hlvis |
| 233 | +hlvis : bin/hlvis printusage |
| 234 | + @echo ======== OK ======== |
| 235 | + |
| 236 | +.PHONY : hlrad |
| 237 | +hlrad : bin/hlrad printusage |
| 238 | + @echo ======== OK ======== |
| 239 | + |
| 240 | +.PHONY : ripent |
| 241 | +ripent : bin/ripent printusage |
| 242 | + @echo ======== OK ======== |
| 243 | + |
| 244 | +bin/hlcsg : $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) printusage |
| 245 | + @echo ======== hlcsg : linking ======== |
| 246 | + mkdir -p hlcsg/release/bin |
| 247 | + g++ $(COMMON_FLAGS) -o hlcsg/release/bin/hlcsg $(addprefix -I,$(HLCSG_INCLUDEDIRS)) $(addprefix -D,$(HLCSG_DEFINITIONS)) $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) |
| 248 | + mkdir -p bin |
| 249 | + cp hlcsg/release/bin/hlcsg bin/hlcsg |
| 250 | + |
| 251 | +$(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) : hlcsg/release/%.o : %.cpp $(HLCSG_INCLUDEFILES) printusage |
| 252 | + @echo ======== hlcsg : compiling $< ======== |
| 253 | + mkdir -p $(dir $@) |
| 254 | + g++ -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLCSG_INCLUDEDIRS)) $(addprefix -D,$(HLCSG_DEFINITIONS)) $< |
| 255 | + |
| 256 | +bin/hlbsp : $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) printusage |
| 257 | + @echo ======== hlbsp : linking ======== |
| 258 | + mkdir -p hlbsp/release/bin |
| 259 | + g++ $(COMMON_FLAGS) -o hlbsp/release/bin/hlbsp $(addprefix -I,$(HLBSP_INCLUDEDIRS)) $(addprefix -D,$(HLBSP_DEFINITIONS)) $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) |
| 260 | + mkdir -p bin |
| 261 | + cp hlbsp/release/bin/hlbsp bin/hlbsp |
| 262 | + |
| 263 | +$(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) : hlbsp/release/%.o : %.cpp $(HLBSP_INCLUDEFILES) printusage |
| 264 | + @echo ======== hlbsp : compiling $< ======== |
| 265 | + mkdir -p $(dir $@) |
| 266 | + g++ -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLBSP_INCLUDEDIRS)) $(addprefix -D,$(HLBSP_DEFINITIONS)) $< |
| 267 | + |
| 268 | +bin/hlvis : $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) printusage |
| 269 | + @echo ======== hlvis : linking ======== |
| 270 | + mkdir -p hlvis/release/bin |
| 271 | + g++ $(COMMON_FLAGS) -o hlvis/release/bin/hlvis $(addprefix -I,$(HLVIS_INCLUDEDIRS)) $(addprefix -D,$(HLVIS_DEFINITIONS)) $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) |
| 272 | + mkdir -p bin |
| 273 | + cp hlvis/release/bin/hlvis bin/hlvis |
| 274 | + |
| 275 | +$(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) : hlvis/release/%.o : %.cpp $(HLVIS_INCLUDEFILES) printusage |
| 276 | + @echo ======== hlvis : compiling $< ======== |
| 277 | + mkdir -p $(dir $@) |
| 278 | + g++ -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLVIS_INCLUDEDIRS)) $(addprefix -D,$(HLVIS_DEFINITIONS)) $< |
| 279 | + |
| 280 | +bin/hlrad : $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) printusage |
| 281 | + @echo ======== hlrad : linking ======== |
| 282 | + mkdir -p hlrad/release/bin |
| 283 | + g++ $(COMMON_FLAGS) -o hlrad/release/bin/hlrad $(addprefix -I,$(HLRAD_INCLUDEDIRS)) $(addprefix -D,$(HLRAD_DEFINITIONS)) $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) |
| 284 | + mkdir -p bin |
| 285 | + cp hlrad/release/bin/hlrad bin/hlrad |
| 286 | + |
| 287 | +$(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) : hlrad/release/%.o : %.cpp $(HLRAD_INCLUDEFILES) printusage |
| 288 | + @echo ======== hlrad : compiling $< ======== |
| 289 | + mkdir -p $(dir $@) |
| 290 | + g++ -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(HLRAD_INCLUDEDIRS)) $(addprefix -D,$(HLRAD_DEFINITIONS)) $< |
| 291 | + |
| 292 | +bin/ripent : $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) printusage |
| 293 | + @echo ======== ripent : linking ======== |
| 294 | + mkdir -p ripent/release/bin |
| 295 | + g++ $(COMMON_FLAGS) -o ripent/release/bin/ripent $(addprefix -I,$(RIPENT_INCLUDEDIRS)) $(addprefix -D,$(RIPENT_DEFINITIONS)) $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) |
| 296 | + mkdir -p bin |
| 297 | + cp ripent/release/bin/ripent bin/ripent |
| 298 | + |
| 299 | +$(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) : ripent/release/%.o : %.cpp $(RIPENT_INCLUDEFILES) printusage |
| 300 | + @echo ======== ripent : compiling $< ======== |
| 301 | + mkdir -p $(dir $@) |
| 302 | + g++ -c $(COMMON_FLAGS) -o $@ $(addprefix -I,$(RIPENT_INCLUDEDIRS)) $(addprefix -D,$(RIPENT_DEFINITIONS)) $< |
| 303 | + |
| 304 | +.PHONY : printusage |
| 305 | +printusage : |
| 306 | + head -n 35 Makefile |
| 307 | + |
| 308 | +# |
| 309 | +# Clean |
| 310 | +# |
| 311 | + |
| 312 | +.PHONY : clean |
| 313 | +clean : printusage |
| 314 | + rm -rf hlcsg/release |
| 315 | + rm -rf hlbsp/release |
| 316 | + rm -rf hlvis/release |
| 317 | + rm -rf hlrad/release |
| 318 | + rm -rf ripent/release |
| 319 | + rm -rf bin |
| 320 | + @echo ======== OK ======== |
| 321 | + |
| 322 | + |
0 commit comments