You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2262 lines
56KB

  1. #
  2. # ioq3 Makefile
  3. #
  4. # GNU Make required
  5. #
  6. COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
  7. COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')
  8. ifeq ($(COMPILE_PLATFORM),sunos)
  9. # Solaris uname and GNU uname differ
  10. COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/')
  11. endif
  12. ifndef BUILD_CLIENT
  13. BUILD_CLIENT =
  14. endif
  15. ifndef BUILD_SERVER
  16. BUILD_SERVER =
  17. endif
  18. ifndef BUILD_RENDERER_OPENGL2
  19. BUILD_RENDERER_OPENGL2=
  20. endif
  21. ifndef BUILD_AUTOUPDATER # DON'T build unless you mean to!
  22. BUILD_AUTOUPDATER=0
  23. endif
  24. #############################################################################
  25. #
  26. # If you require a different configuration from the defaults below, create a
  27. # new file named "Makefile.local" in the same directory as this file and define
  28. # your parameters there. This allows you to change configuration without
  29. # causing problems with keeping up to date with the repository.
  30. #
  31. #############################################################################
  32. -include Makefile.local
  33. ifeq ($(COMPILE_PLATFORM),cygwin)
  34. PLATFORM=mingw32
  35. endif
  36. ifndef PLATFORM
  37. PLATFORM=$(COMPILE_PLATFORM)
  38. endif
  39. export PLATFORM
  40. ifeq ($(PLATFORM),mingw32)
  41. MINGW=1
  42. endif
  43. ifeq ($(PLATFORM),mingw64)
  44. MINGW=1
  45. endif
  46. ifeq ($(COMPILE_ARCH),i86pc)
  47. COMPILE_ARCH=x86
  48. endif
  49. ifeq ($(COMPILE_ARCH),amd64)
  50. COMPILE_ARCH=x86_64
  51. endif
  52. ifeq ($(COMPILE_ARCH),x64)
  53. COMPILE_ARCH=x86_64
  54. endif
  55. ifeq ($(COMPILE_ARCH),powerpc)
  56. COMPILE_ARCH=ppc
  57. endif
  58. ifeq ($(COMPILE_ARCH),powerpc64)
  59. COMPILE_ARCH=ppc64
  60. endif
  61. ifeq ($(COMPILE_ARCH),axp)
  62. COMPILE_ARCH=alpha
  63. endif
  64. ifndef ARCH
  65. ARCH=$(COMPILE_ARCH)
  66. endif
  67. export ARCH
  68. ifneq ($(PLATFORM),$(COMPILE_PLATFORM))
  69. CROSS_COMPILING=1
  70. else
  71. CROSS_COMPILING=0
  72. ifneq ($(ARCH),$(COMPILE_ARCH))
  73. CROSS_COMPILING=1
  74. endif
  75. endif
  76. export CROSS_COMPILING
  77. ifndef VERSION
  78. VERSION=m9
  79. endif
  80. ifndef CLIENTBIN
  81. CLIENTBIN=urbanterror-m9
  82. endif
  83. ifndef SERVERBIN
  84. SERVERBIN=urbanterror-server-m9
  85. endif
  86. ifndef COPYDIR
  87. COPYDIR="/opt/urbanterror"
  88. endif
  89. ifndef COPYBINDIR
  90. COPYBINDIR=$(COPYDIR)
  91. endif
  92. ifndef MOUNT_DIR
  93. MOUNT_DIR=code
  94. endif
  95. ifndef EXTERNAL_DIR
  96. EXTERNAL_DIR=external
  97. endif
  98. ifndef LIBS_DIR
  99. LIBS_DIR=libs
  100. endif
  101. ifndef BUILD_DIR
  102. BUILD_DIR=build
  103. endif
  104. ifndef TEMPDIR
  105. TEMPDIR=/tmp
  106. endif
  107. ifndef GENERATE_DEPENDENCIES
  108. GENERATE_DEPENDENCIES=1
  109. endif
  110. ifndef USE_OPENAL
  111. USE_OPENAL=1
  112. endif
  113. ifndef USE_OPENAL_DLOPEN
  114. USE_OPENAL_DLOPEN=1
  115. endif
  116. ifndef USE_CURL
  117. USE_CURL=1
  118. endif
  119. ifndef USE_CURL_DLOPEN
  120. ifdef MINGW
  121. USE_CURL_DLOPEN=0
  122. else
  123. USE_CURL_DLOPEN=1
  124. endif
  125. endif
  126. ifndef USE_CODEC_VORBIS
  127. USE_CODEC_VORBIS=1
  128. endif
  129. ifndef USE_CODEC_OPUS
  130. USE_CODEC_OPUS=1
  131. endif
  132. ifndef USE_MUMBLE
  133. USE_MUMBLE=1
  134. endif
  135. ifndef USE_VOIP
  136. USE_VOIP=1
  137. endif
  138. ifndef USE_FREETYPE
  139. USE_FREETYPE=0
  140. endif
  141. ifndef USE_INTERNAL_LIBS
  142. USE_INTERNAL_LIBS=1
  143. endif
  144. ifndef USE_INTERNAL_OGG
  145. USE_INTERNAL_OGG=$(USE_INTERNAL_LIBS)
  146. endif
  147. ifndef USE_INTERNAL_VORBIS
  148. USE_INTERNAL_VORBIS=$(USE_INTERNAL_LIBS)
  149. endif
  150. ifndef USE_INTERNAL_OPUS
  151. USE_INTERNAL_OPUS=$(USE_INTERNAL_LIBS)
  152. endif
  153. ifndef USE_INTERNAL_ZLIB
  154. USE_INTERNAL_ZLIB=$(USE_INTERNAL_LIBS)
  155. endif
  156. ifndef USE_INTERNAL_JPEG
  157. USE_INTERNAL_JPEG=$(USE_INTERNAL_LIBS)
  158. endif
  159. ifndef USE_LOCAL_HEADERS
  160. USE_LOCAL_HEADERS=$(USE_INTERNAL_LIBS)
  161. endif
  162. ifndef USE_RENDERER_DLOPEN
  163. USE_RENDERER_DLOPEN=1
  164. endif
  165. ifndef USE_AUTOUPDATER # DON'T include unless you mean to!
  166. USE_AUTOUPDATER=0
  167. endif
  168. ifndef DEBUG_CFLAGS
  169. DEBUG_CFLAGS=-ggdb -O0
  170. endif
  171. ifndef USE_DEMO_FORMAT_42
  172. USE_DEMO_FORMAT_42=1
  173. endif
  174. ifndef USE_AUTH
  175. USE_AUTH=1
  176. endif
  177. ifndef USE_ALTGAMMA
  178. # Clearskies - X11-based gamma for Linux
  179. USE_ALTGAMMA=1
  180. endif
  181. ifndef USE_SKEETMOD
  182. USE_SKEETMOD=0
  183. endif
  184. #############################################################################
  185. BD=$(BUILD_DIR)/debug-$(PLATFORM)-$(ARCH)
  186. BR=$(BUILD_DIR)/release-$(PLATFORM)-$(ARCH)
  187. CDIR=$(MOUNT_DIR)/client
  188. SDIR=$(MOUNT_DIR)/server
  189. RCOMMONDIR=$(MOUNT_DIR)/renderercommon
  190. RGL1DIR=$(MOUNT_DIR)/renderergl1
  191. RGL2DIR=$(MOUNT_DIR)/renderergl2
  192. CMDIR=$(MOUNT_DIR)/qcommon
  193. SDLDIR=$(MOUNT_DIR)/sdl
  194. ASMDIR=$(MOUNT_DIR)/asm
  195. SYSDIR=$(MOUNT_DIR)/sys
  196. BLIBDIR=$(MOUNT_DIR)/botlib
  197. NDIR=$(MOUNT_DIR)/null
  198. JPDIR=$(EXTERNAL_DIR)/jpeg-8c
  199. OGGDIR=$(EXTERNAL_DIR)/libogg-1.3.3
  200. VORBISDIR=$(EXTERNAL_DIR)/libvorbis-1.3.6
  201. OPUSDIR=$(EXTERNAL_DIR)/opus-1.2.1
  202. OPUSFILEDIR=$(EXTERNAL_DIR)/opusfile-0.9
  203. ZDIR=$(EXTERNAL_DIR)/zlib
  204. SDLHDIR=$(EXTERNAL_DIR)/SDL2
  205. LIBSDIR=$(LIBS_DIR)
  206. AUTOUPDATERSRCDIR=$(MOUNT_DIR)/autoupdater
  207. LIBTOMCRYPTSRCDIR=$(AUTOUPDATERSRCDIR)/rsa_tools/libtomcrypt-1.17
  208. TOMSFASTMATHSRCDIR=$(AUTOUPDATERSRCDIR)/rsa_tools/tomsfastmath-0.13.1
  209. bin_path=$(shell which $(1) 2> /dev/null)
  210. # The autoupdater uses curl, so figure out its flags no matter what.
  211. # We won't need this if we only build the server
  212. # set PKG_CONFIG_PATH or PKG_CONFIG to influence this, e.g.
  213. # PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig or
  214. # PKG_CONFIG=arm-linux-gnueabihf-pkg-config
  215. ifeq ($(CROSS_COMPILING),0)
  216. PKG_CONFIG ?= pkg-config
  217. else
  218. ifneq ($(PKG_CONFIG_PATH),)
  219. PKG_CONFIG ?= pkg-config
  220. else
  221. # Don't use host pkg-config when cross-compiling.
  222. # (unknown-pkg-config is meant to be a non-existant command.)
  223. PKG_CONFIG ?= unknown-pkg-config
  224. endif
  225. endif
  226. ifneq ($(call bin_path, $(PKG_CONFIG)),)
  227. CURL_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags libcurl)
  228. CURL_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs libcurl)
  229. OPENAL_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags openal)
  230. OPENAL_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs openal)
  231. SDL_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
  232. SDL_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs sdl2)
  233. else
  234. # assume they're in the system default paths (no -I or -L needed)
  235. CURL_LIBS ?= -lcurl
  236. OPENAL_LIBS ?= -lopenal
  237. endif
  238. # Use sdl2-config if all else fails
  239. ifeq ($(SDL_CFLAGS),)
  240. ifneq ($(call bin_path, sdl2-config),)
  241. SDL_CFLAGS = $(shell sdl2-config --cflags)
  242. SDL_LIBS = $(shell sdl2-config --libs)
  243. endif
  244. endif
  245. # Add git version info
  246. USE_GIT=
  247. ifeq ($(wildcard .git),.git)
  248. GIT_REV=$(shell git describe --always)
  249. ifneq ($(GIT_REV),)
  250. VERSION:=$(VERSION)-$(GIT_REV)
  251. USE_GIT=1
  252. endif
  253. endif
  254. #############################################################################
  255. # SETUP AND BUILD -- LINUX
  256. #############################################################################
  257. INSTALL=install
  258. MKDIR=mkdir -p
  259. EXTRA_FILES=
  260. CLIENT_EXTRA_FILES=
  261. ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
  262. BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
  263. -pipe -DUSE_ICON -DARCH_STRING=\\\"$(ARCH)\\\"
  264. CLIENT_CFLAGS += $(SDL_CFLAGS)
  265. OPTIMIZEVM = -O3
  266. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  267. ifeq ($(ARCH),x86_64)
  268. OPTIMIZEVM = -O3
  269. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  270. HAVE_VM_COMPILED = true
  271. else
  272. ifeq ($(ARCH),x86)
  273. OPTIMIZEVM = -O3 -march=i586
  274. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  275. HAVE_VM_COMPILED=true
  276. else
  277. ifeq ($(ARCH),ppc)
  278. ALTIVEC_CFLAGS = -maltivec
  279. HAVE_VM_COMPILED=true
  280. endif
  281. ifeq ($(ARCH),ppc64)
  282. ALTIVEC_CFLAGS = -maltivec
  283. HAVE_VM_COMPILED=true
  284. endif
  285. ifeq ($(ARCH),sparc)
  286. OPTIMIZE += -mtune=ultrasparc3 -mv8plus
  287. OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus
  288. HAVE_VM_COMPILED=true
  289. endif
  290. ifeq ($(ARCH),armv7l)
  291. HAVE_VM_COMPILED=true
  292. endif
  293. ifeq ($(ARCH),alpha)
  294. # According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555
  295. # -ffast-math will cause the client to die with SIGFPE on Alpha
  296. OPTIMIZE = $(OPTIMIZEVM)
  297. endif
  298. endif
  299. endif
  300. SHLIBEXT=so
  301. SHLIBCFLAGS=-fPIC -fvisibility=hidden
  302. SHLIBLDFLAGS=-shared $(LDFLAGS)
  303. THREAD_LIBS=-lpthread
  304. LIBS=-ldl -lm
  305. AUTOUPDATER_LIBS += -ldl
  306. CLIENT_LIBS=$(SDL_LIBS)
  307. RENDERER_LIBS = $(SDL_LIBS)
  308. ifeq ($(USE_OPENAL),1)
  309. ifneq ($(USE_OPENAL_DLOPEN),1)
  310. CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
  311. endif
  312. endif
  313. ifeq ($(USE_CURL),1)
  314. CLIENT_CFLAGS += $(CURL_CFLAGS)
  315. ifneq ($(USE_CURL_DLOPEN),1)
  316. CLIENT_LIBS += $(CURL_LIBS)
  317. endif
  318. endif
  319. ifeq ($(USE_MUMBLE),1)
  320. CLIENT_LIBS += -lrt
  321. endif
  322. ifeq ($(USE_ALTGAMMA), 1)
  323. BASE_CFLAGS += -DUSE_ALTGAMMA=1
  324. RENDERER_LIBS += -lX11 -lXxf86vm
  325. endif
  326. ifeq ($(ARCH),x86)
  327. # linux32 make ...
  328. BASE_CFLAGS += -m32
  329. else
  330. ifeq ($(ARCH),ppc64)
  331. BASE_CFLAGS += -m64
  332. endif
  333. endif
  334. else # ifeq Linux
  335. #############################################################################
  336. # SETUP AND BUILD -- MAC OS X
  337. #############################################################################
  338. ifeq ($(PLATFORM),darwin)
  339. HAVE_VM_COMPILED=true
  340. LIBS = -framework Cocoa
  341. CLIENT_LIBS=
  342. RENDERER_LIBS=
  343. OPTIMIZEVM = -O3
  344. # Default minimum Mac OS X version
  345. ifeq ($(MACOSX_VERSION_MIN),)
  346. MACOSX_VERSION_MIN=10.7
  347. endif
  348. MACOSX_MAJOR=$(shell echo $(MACOSX_VERSION_MIN) | cut -d. -f1)
  349. MACOSX_MINOR=$(shell echo $(MACOSX_VERSION_MIN) | cut -d. -f2)
  350. ifeq ($(shell test $(MACOSX_MINOR) -gt 9; echo $$?),0)
  351. # Multiply and then remove decimal. 10.10 -> 101000.0 -> 101000
  352. MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo "$(MACOSX_MAJOR) * 10000 + $(MACOSX_MINOR) * 100" | bc | cut -d. -f1)
  353. else
  354. # Multiply by 100 and then remove decimal. 10.7 -> 1070.0 -> 1070
  355. MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo "$(MACOSX_VERSION_MIN) * 100" | bc | cut -d. -f1)
  356. endif
  357. LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
  358. BASE_CFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) \
  359. -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED)
  360. ifeq ($(ARCH),ppc)
  361. BASE_CFLAGS += -arch ppc
  362. ALTIVEC_CFLAGS = -faltivec
  363. endif
  364. ifeq ($(ARCH),ppc64)
  365. BASE_CFLAGS += -arch ppc64
  366. ALTIVEC_CFLAGS = -faltivec
  367. endif
  368. ifeq ($(ARCH),x86)
  369. OPTIMIZEVM += -march=prescott -mfpmath=sse
  370. # x86 vm will crash without -mstackrealign since MMX instructions will be
  371. # used no matter what and they corrupt the frame pointer in VM calls
  372. BASE_CFLAGS += -arch i386 -m32 -mstackrealign
  373. endif
  374. ifeq ($(ARCH),x86_64)
  375. OPTIMIZEVM += -mfpmath=sse
  376. BASE_CFLAGS += -arch x86_64
  377. endif
  378. # When compiling on OSX for OSX, we're not cross compiling as far as the
  379. # Makefile is concerned, as target architecture is specified as a compiler
  380. # argument
  381. ifeq ($(COMPILE_PLATFORM),darwin)
  382. CROSS_COMPILING=0
  383. endif
  384. ifeq ($(CROSS_COMPILING),1)
  385. ifeq ($(ARCH),x86_64)
  386. CC=x86_64-apple-darwin13-cc
  387. RANLIB=x86_64-apple-darwin13-ranlib
  388. else
  389. ifeq ($(ARCH),x86)
  390. CC=i386-apple-darwin13-cc
  391. RANLIB=i386-apple-darwin13-ranlib
  392. else
  393. $(error Architecture $(ARCH) is not supported when cross compiling)
  394. endif
  395. endif
  396. endif
  397. BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe
  398. ifeq ($(USE_OPENAL),1)
  399. ifneq ($(USE_LOCAL_HEADERS),1)
  400. CLIENT_CFLAGS += -I/System/Library/Frameworks/OpenAL.framework/Headers
  401. endif
  402. ifneq ($(USE_OPENAL_DLOPEN),1)
  403. CLIENT_LIBS += -framework OpenAL
  404. endif
  405. endif
  406. ifeq ($(USE_CURL),1)
  407. CLIENT_CFLAGS += $(CURL_CFLAGS)
  408. ifneq ($(USE_CURL_DLOPEN),1)
  409. CLIENT_LIBS += $(CURL_LIBS)
  410. endif
  411. endif
  412. BASE_CFLAGS += -D_THREAD_SAFE=1
  413. CLIENT_LIBS += -framework IOKit
  414. RENDERER_LIBS += -framework OpenGL
  415. ifeq ($(USE_LOCAL_HEADERS),1)
  416. # libSDL2-2.0.0.dylib for PPC is SDL 2.0.1 + changes to compile
  417. ifneq ($(findstring $(ARCH),ppc ppc64),)
  418. BASE_CFLAGS += -I$(SDLHDIR)/include-macppc
  419. else
  420. BASE_CFLAGS += -I$(SDLHDIR)/include
  421. endif
  422. # We copy sdlmain before ranlib'ing it so that subversion doesn't think
  423. # the file has been modified by each build.
  424. LIBSDLMAIN=$(B)/libSDL2main.a
  425. LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a
  426. CLIENT_LIBS += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
  427. RENDERER_LIBS += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
  428. CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
  429. else
  430. BASE_CFLAGS += -I/Library/Frameworks/SDL2.framework/Headers
  431. CLIENT_LIBS += -framework SDL2
  432. RENDERER_LIBS += -framework SDL2
  433. endif
  434. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  435. SHLIBEXT=dylib
  436. SHLIBCFLAGS=-fPIC -fno-common
  437. SHLIBLDFLAGS=-dynamiclib $(LDFLAGS) -Wl,-U,_com_altivec
  438. NOTSHLIBCFLAGS=-mdynamic-no-pic
  439. else # ifeq darwin
  440. #############################################################################
  441. # SETUP AND BUILD -- MINGW32
  442. #############################################################################
  443. ifdef MINGW
  444. ifeq ($(CROSS_COMPILING),1)
  445. # If CC is already set to something generic, we probably want to use
  446. # something more specific
  447. ifneq ($(findstring $(strip $(CC)),cc gcc),)
  448. CC=
  449. endif
  450. # We need to figure out the correct gcc and windres
  451. ifeq ($(ARCH),x86_64)
  452. MINGW_PREFIXES=x86_64-w64-mingw32 amd64-mingw32msvc
  453. endif
  454. ifeq ($(ARCH),x86)
  455. MINGW_PREFIXES=i686-w64-mingw32 i586-mingw32msvc i686-pc-mingw32
  456. endif
  457. ifndef CC
  458. CC=$(firstword $(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
  459. $(call bin_path, $(MINGW_PREFIX)-gcc))))
  460. endif
  461. ifndef WINDRES
  462. WINDRES=$(firstword $(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
  463. $(call bin_path, $(MINGW_PREFIX)-windres))))
  464. endif
  465. else
  466. # Some MinGW installations define CC to cc, but don't actually provide cc,
  467. # so check that CC points to a real binary and use gcc if it doesn't
  468. ifeq ($(call bin_path, $(CC)),)
  469. CC=gcc
  470. endif
  471. endif
  472. # using generic windres if specific one is not present
  473. ifndef WINDRES
  474. WINDRES=windres
  475. endif
  476. ifeq ($(CC),)
  477. $(error Cannot find a suitable cross compiler for $(PLATFORM))
  478. endif
  479. BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
  480. -DUSE_ICON
  481. # In the absence of wspiapi.h, require Windows XP or later
  482. ifeq ($(shell test -e $(CMDIR)/wspiapi.h; echo $$?),1)
  483. BASE_CFLAGS += -DWINVER=0x501
  484. endif
  485. ifeq ($(USE_OPENAL),1)
  486. CLIENT_CFLAGS += $(OPENAL_CFLAGS)
  487. ifneq ($(USE_OPENAL_DLOPEN),1)
  488. CLIENT_LDFLAGS += $(OPENAL_LDFLAGS)
  489. endif
  490. endif
  491. ifeq ($(ARCH),x86_64)
  492. OPTIMIZEVM = -O3
  493. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  494. HAVE_VM_COMPILED = true
  495. endif
  496. ifeq ($(ARCH),x86)
  497. OPTIMIZEVM = -O3 -march=i586
  498. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  499. HAVE_VM_COMPILED = true
  500. endif
  501. SHLIBEXT=dll
  502. SHLIBCFLAGS=
  503. SHLIBLDFLAGS=-shared $(LDFLAGS)
  504. BINEXT=.exe
  505. LIBS= -lws2_32 -lwinmm -lpsapi
  506. AUTOUPDATER_LIBS += -lwininet
  507. # clang 3.4 doesn't support this
  508. ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
  509. CLIENT_LDFLAGS += -mwindows
  510. endif
  511. CLIENT_LIBS = -lgdi32 -lole32
  512. RENDERER_LIBS = -lgdi32 -lole32 -static-libgcc
  513. ifeq ($(USE_FREETYPE),1)
  514. FREETYPE_CFLAGS = -Ifreetype2
  515. endif
  516. ifeq ($(USE_CURL),1)
  517. CLIENT_CFLAGS += $(CURL_CFLAGS)
  518. ifneq ($(USE_CURL_DLOPEN),1)
  519. ifeq ($(USE_LOCAL_HEADERS),1)
  520. CLIENT_CFLAGS += -DCURL_STATICLIB
  521. ifeq ($(ARCH),x86_64)
  522. CLIENT_LIBS += $(LIBSDIR)/win64/libcurl.a -lcrypt32
  523. else
  524. CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a -lcrypt32
  525. endif
  526. else
  527. CLIENT_LIBS += $(CURL_LIBS)
  528. endif
  529. endif
  530. endif
  531. ifeq ($(ARCH),x86)
  532. # build 32bit
  533. BASE_CFLAGS += -m32
  534. else
  535. BASE_CFLAGS += -m64
  536. endif
  537. # libmingw32 must be linked before libSDLmain
  538. CLIENT_LIBS += -lmingw32
  539. RENDERER_LIBS += -lmingw32
  540. ifeq ($(USE_LOCAL_HEADERS),1)
  541. CLIENT_CFLAGS += -I$(SDLHDIR)/include
  542. ifeq ($(ARCH),x86)
  543. CLIENT_LIBS += $(LIBSDIR)/win32/libSDL2main.a \
  544. $(LIBSDIR)/win32/libSDL2.dll.a
  545. RENDERER_LIBS += $(LIBSDIR)/win32/libSDL2main.a \
  546. $(LIBSDIR)/win32/libSDL2.dll.a
  547. SDLDLL=SDL2.dll
  548. CLIENT_EXTRA_FILES += $(LIBSDIR)/win32/SDL2.dll
  549. else
  550. CLIENT_LIBS += $(LIBSDIR)/win64/libSDL264main.a \
  551. $(LIBSDIR)/win64/libSDL264.dll.a
  552. RENDERER_LIBS += $(LIBSDIR)/win64/libSDL264main.a \
  553. $(LIBSDIR)/win64/libSDL264.dll.a
  554. SDLDLL=SDL264.dll
  555. CLIENT_EXTRA_FILES += $(LIBSDIR)/win64/SDL264.dll
  556. endif
  557. else
  558. CLIENT_CFLAGS += $(SDL_CFLAGS)
  559. CLIENT_LIBS += $(SDL_LIBS)
  560. RENDERER_LIBS += $(SDL_LIBS)
  561. SDLDLL=SDL2.dll
  562. endif
  563. else # ifdef MINGW
  564. #############################################################################
  565. # SETUP AND BUILD -- FREEBSD
  566. #############################################################################
  567. ifeq ($(PLATFORM),freebsd)
  568. # flags
  569. BASE_CFLAGS = \
  570. -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
  571. -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
  572. CLIENT_CFLAGS += $(SDL_CFLAGS)
  573. HAVE_VM_COMPILED = true
  574. OPTIMIZEVM =
  575. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  576. SHLIBEXT=so
  577. SHLIBCFLAGS=-fPIC
  578. SHLIBLDFLAGS=-shared $(LDFLAGS)
  579. THREAD_LIBS=-lpthread
  580. # don't need -ldl (FreeBSD)
  581. LIBS=-lm
  582. CLIENT_LIBS =
  583. CLIENT_LIBS += $(SDL_LIBS)
  584. RENDERER_LIBS = $(SDL_LIBS)
  585. # optional features/libraries
  586. ifeq ($(USE_OPENAL),1)
  587. ifeq ($(USE_OPENAL_DLOPEN),1)
  588. CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
  589. endif
  590. endif
  591. ifeq ($(USE_CURL),1)
  592. CLIENT_CFLAGS += $(CURL_CFLAGS)
  593. ifeq ($(USE_CURL_DLOPEN),1)
  594. CLIENT_LIBS += $(CURL_LIBS)
  595. endif
  596. endif
  597. # cross-compiling tweaks
  598. ifeq ($(ARCH),x86)
  599. ifeq ($(CROSS_COMPILING),1)
  600. BASE_CFLAGS += -m32
  601. endif
  602. endif
  603. ifeq ($(ARCH),x86_64)
  604. ifeq ($(CROSS_COMPILING),1)
  605. BASE_CFLAGS += -m64
  606. endif
  607. endif
  608. else # ifeq freebsd
  609. #############################################################################
  610. # SETUP AND BUILD -- OPENBSD
  611. #############################################################################
  612. ifeq ($(PLATFORM),openbsd)
  613. BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
  614. -pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
  615. CLIENT_CFLAGS += $(SDL_CFLAGS)
  616. OPTIMIZEVM = -O3
  617. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  618. ifeq ($(ARCH),x86_64)
  619. OPTIMIZEVM = -O3
  620. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  621. HAVE_VM_COMPILED = true
  622. else
  623. ifeq ($(ARCH),x86)
  624. OPTIMIZEVM = -O3 -march=i586
  625. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  626. HAVE_VM_COMPILED=true
  627. else
  628. ifeq ($(ARCH),ppc)
  629. ALTIVEC_CFLAGS = -maltivec
  630. HAVE_VM_COMPILED=true
  631. endif
  632. ifeq ($(ARCH),ppc64)
  633. ALTIVEC_CFLAGS = -maltivec
  634. HAVE_VM_COMPILED=true
  635. endif
  636. ifeq ($(ARCH),sparc64)
  637. OPTIMIZE += -mtune=ultrasparc3 -mv8plus
  638. OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus
  639. HAVE_VM_COMPILED=true
  640. endif
  641. ifeq ($(ARCH),alpha)
  642. # According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555
  643. # -ffast-math will cause the client to die with SIGFPE on Alpha
  644. OPTIMIZE = $(OPTIMIZEVM)
  645. endif
  646. endif
  647. endif
  648. ifeq ($(USE_CURL),1)
  649. CLIENT_CFLAGS += $(CURL_CFLAGS)
  650. USE_CURL_DLOPEN=0
  651. endif
  652. # no shm_open on OpenBSD
  653. USE_MUMBLE=0
  654. SHLIBEXT=so
  655. SHLIBCFLAGS=-fPIC
  656. SHLIBLDFLAGS=-shared $(LDFLAGS)
  657. THREAD_LIBS=-lpthread
  658. LIBS=-lm
  659. CLIENT_LIBS =
  660. CLIENT_LIBS += $(SDL_LIBS)
  661. RENDERER_LIBS = $(SDL_LIBS)
  662. ifeq ($(USE_OPENAL),1)
  663. ifneq ($(USE_OPENAL_DLOPEN),1)
  664. CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
  665. endif
  666. endif
  667. ifeq ($(USE_CURL),1)
  668. ifneq ($(USE_CURL_DLOPEN),1)
  669. CLIENT_LIBS += $(CURL_LIBS)
  670. endif
  671. endif
  672. else # ifeq openbsd
  673. #############################################################################
  674. # SETUP AND BUILD -- NETBSD
  675. #############################################################################
  676. ifeq ($(PLATFORM),netbsd)
  677. LIBS=-lm
  678. SHLIBEXT=so
  679. SHLIBCFLAGS=-fPIC
  680. SHLIBLDFLAGS=-shared $(LDFLAGS)
  681. THREAD_LIBS=-lpthread
  682. BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
  683. ifeq ($(ARCH),x86)
  684. HAVE_VM_COMPILED=true
  685. endif
  686. BUILD_CLIENT = 0
  687. else # ifeq netbsd
  688. #############################################################################
  689. # SETUP AND BUILD -- IRIX
  690. #############################################################################
  691. ifeq ($(PLATFORM),irix64)
  692. LIB=lib
  693. ARCH=mips
  694. CC = c99
  695. BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 \
  696. -I. -I$(ROOT)/usr/include
  697. CLIENT_CFLAGS += $(SDL_CFLAGS)
  698. OPTIMIZE = -O3
  699. SHLIBEXT=so
  700. SHLIBCFLAGS=
  701. SHLIBLDFLAGS=-shared
  702. LIBS=-ldl -lm -lgen
  703. AUTOUPDATER_LIBS += -ldl
  704. # FIXME: The X libraries probably aren't necessary?
  705. CLIENT_LIBS=-L/usr/X11/$(LIB) $(SDL_LIBS) \
  706. -lX11 -lXext -lm
  707. RENDERER_LIBS = $(SDL_LIBS)
  708. else # ifeq IRIX
  709. #############################################################################
  710. # SETUP AND BUILD -- SunOS
  711. #############################################################################
  712. ifeq ($(PLATFORM),sunos)
  713. CC=gcc
  714. INSTALL=ginstall
  715. MKDIR=gmkdir -p
  716. COPYDIR="/usr/local/share/games/quake3"
  717. ifneq ($(ARCH),x86)
  718. ifneq ($(ARCH),sparc)
  719. $(error arch $(ARCH) is currently not supported)
  720. endif
  721. endif
  722. BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
  723. -pipe -DUSE_ICON
  724. CLIENT_CFLAGS += $(SDL_CFLAGS)
  725. OPTIMIZEVM = -O3 -funroll-loops
  726. ifeq ($(ARCH),sparc)
  727. OPTIMIZEVM += -O3 \
  728. -fstrength-reduce -falign-functions=2 \
  729. -mtune=ultrasparc3 -mv8plus -mno-faster-structs
  730. HAVE_VM_COMPILED=true
  731. else
  732. ifeq ($(ARCH),x86)
  733. OPTIMIZEVM += -march=i586 -fomit-frame-pointer \
  734. -falign-functions=2 -fstrength-reduce
  735. HAVE_VM_COMPILED=true
  736. BASE_CFLAGS += -m32
  737. CLIENT_CFLAGS += -I/usr/X11/include/NVIDIA
  738. CLIENT_LDFLAGS += -L/usr/X11/lib/NVIDIA -R/usr/X11/lib/NVIDIA
  739. endif
  740. endif
  741. OPTIMIZE = $(OPTIMIZEVM) -ffast-math
  742. SHLIBEXT=so
  743. SHLIBCFLAGS=-fPIC
  744. SHLIBLDFLAGS=-shared $(LDFLAGS)
  745. THREAD_LIBS=-lpthread
  746. LIBS=-lsocket -lnsl -ldl -lm
  747. AUTOUPDATER_LIBS += -ldl
  748. BOTCFLAGS=-O0
  749. CLIENT_LIBS +=$(SDL_LIBS) -lX11 -lXext -liconv -lm
  750. RENDERER_LIBS = $(SDL_LIBS)
  751. else # ifeq sunos
  752. #############################################################################
  753. # SETUP AND BUILD -- GENERIC
  754. #############################################################################
  755. BASE_CFLAGS=
  756. OPTIMIZE = -O3
  757. SHLIBEXT=so
  758. SHLIBCFLAGS=-fPIC
  759. SHLIBLDFLAGS=-shared
  760. endif #Linux
  761. endif #darwin
  762. endif #MINGW
  763. endif #FreeBSD
  764. endif #OpenBSD
  765. endif #NetBSD
  766. endif #IRIX
  767. endif #SunOS
  768. ifndef CC
  769. CC=gcc
  770. endif
  771. ifndef RANLIB
  772. RANLIB=ranlib
  773. endif
  774. ifneq ($(HAVE_VM_COMPILED),true)
  775. BASE_CFLAGS += -DNO_VM_COMPILED
  776. endif
  777. TARGETS =
  778. ifndef FULLBINEXT
  779. FULLBINEXT=.$(ARCH)$(BINEXT)
  780. endif
  781. ifndef SHLIBNAME
  782. SHLIBNAME=$(ARCH).$(SHLIBEXT)
  783. endif
  784. ifneq ($(BUILD_SERVER),0)
  785. TARGETS += $(B)/$(SERVERBIN)$(FULLBINEXT)
  786. endif
  787. ifneq ($(BUILD_CLIENT),0)
  788. ifneq ($(USE_RENDERER_DLOPEN),0)
  789. TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) $(B)/renderer_opengl1_$(SHLIBNAME)
  790. ifneq ($(BUILD_RENDERER_OPENGL2),0)
  791. TARGETS += $(B)/renderer_opengl2_$(SHLIBNAME)
  792. endif
  793. else
  794. TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT)
  795. ifneq ($(BUILD_RENDERER_OPENGL2),0)
  796. TARGETS += $(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT)
  797. endif
  798. endif
  799. endif
  800. ifneq ($(BUILD_AUTOUPDATER),0)
  801. # PLEASE NOTE that if you run an exe on Windows Vista or later
  802. # with "setup", "install", "update" or other related terms, it
  803. # will unconditionally trigger a UAC prompt, and in the case of
  804. # ioq3 calling CreateProcess() on it, it'll just fail immediately.
  805. # So don't call this thing "autoupdater" here!
  806. AUTOUPDATER_BIN := autosyncerator$(FULLBINEXT)
  807. TARGETS += $(B)/$(AUTOUPDATER_BIN)
  808. endif
  809. ifeq ($(USE_OPENAL),1)
  810. CLIENT_CFLAGS += -DUSE_OPENAL
  811. ifeq ($(USE_OPENAL_DLOPEN),1)
  812. CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN
  813. endif
  814. endif
  815. ifeq ($(USE_CURL),1)
  816. CLIENT_CFLAGS += -DUSE_CURL
  817. ifeq ($(USE_CURL_DLOPEN),1)
  818. CLIENT_CFLAGS += -DUSE_CURL_DLOPEN
  819. endif
  820. endif
  821. ifeq ($(USE_VOIP),1)
  822. CLIENT_CFLAGS += -DUSE_VOIP
  823. SERVER_CFLAGS += -DUSE_VOIP
  824. NEED_OPUS=1
  825. endif
  826. ifeq ($(USE_CODEC_OPUS),1)
  827. CLIENT_CFLAGS += -DUSE_CODEC_OPUS
  828. NEED_OPUS=1
  829. endif
  830. ifeq ($(NEED_OPUS),1)
  831. ifeq ($(USE_INTERNAL_OPUS),1)
  832. OPUS_CFLAGS = -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DFLOAT_APPROX -DUSE_ALLOCA \
  833. -I$(OPUSDIR)/include -I$(OPUSDIR)/celt -I$(OPUSDIR)/silk \
  834. -I$(OPUSDIR)/silk/float -I$(OPUSFILEDIR)/include
  835. else
  836. OPUS_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags opusfile opus || true)
  837. OPUS_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs opusfile opus || echo -lopusfile -lopus)
  838. endif
  839. CLIENT_CFLAGS += $(OPUS_CFLAGS)
  840. CLIENT_LIBS += $(OPUS_LIBS)
  841. NEED_OGG=1
  842. endif
  843. ifeq ($(USE_CODEC_VORBIS),1)
  844. CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
  845. ifeq ($(USE_INTERNAL_VORBIS),1)
  846. CLIENT_CFLAGS += -I$(VORBISDIR)/include -I$(VORBISDIR)/lib
  847. else
  848. VORBIS_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags vorbisfile vorbis || true)
  849. VORBIS_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs vorbisfile vorbis || echo -lvorbisfile -lvorbis)
  850. endif
  851. CLIENT_CFLAGS += $(VORBIS_CFLAGS)
  852. CLIENT_LIBS += $(VORBIS_LIBS)
  853. NEED_OGG=1
  854. endif
  855. ifeq ($(NEED_OGG),1)
  856. ifeq ($(USE_INTERNAL_OGG),1)
  857. OGG_CFLAGS = -I$(OGGDIR)/include
  858. else
  859. OGG_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags ogg || true)
  860. OGG_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs ogg || echo -logg)
  861. endif
  862. CLIENT_CFLAGS += $(OGG_CFLAGS)
  863. CLIENT_LIBS += $(OGG_LIBS)
  864. endif
  865. ifeq ($(USE_RENDERER_DLOPEN),1)
  866. CLIENT_CFLAGS += -DUSE_RENDERER_DLOPEN
  867. endif
  868. ifeq ($(USE_MUMBLE),1)
  869. CLIENT_CFLAGS += -DUSE_MUMBLE
  870. endif
  871. ifeq ($(USE_INTERNAL_ZLIB),1)
  872. ZLIB_CFLAGS = -DNO_GZIP -I$(ZDIR)
  873. else
  874. ZLIB_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags zlib || true)
  875. ZLIB_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs zlib || echo -lz)
  876. endif
  877. BASE_CFLAGS += $(ZLIB_CFLAGS)
  878. LIBS += $(ZLIB_LIBS)
  879. ifeq ($(USE_INTERNAL_JPEG),1)
  880. BASE_CFLAGS += -DUSE_INTERNAL_JPEG
  881. BASE_CFLAGS += -I$(JPDIR)
  882. else
  883. # IJG libjpeg doesn't have pkg-config, but libjpeg-turbo uses libjpeg.pc;
  884. # we fall back to hard-coded answers if libjpeg.pc is unavailable
  885. JPEG_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags libjpeg || true)
  886. JPEG_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs libjpeg || echo -ljpeg)
  887. BASE_CFLAGS += $(JPEG_CFLAGS)
  888. RENDERER_LIBS += $(JPEG_LIBS)
  889. endif
  890. ifeq ($(USE_FREETYPE),1)
  891. FREETYPE_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags freetype2 || true)
  892. FREETYPE_LIBS ?= $(shell $(PKG_CONFIG) --silence-errors --libs freetype2 || echo -lfreetype)
  893. BASE_CFLAGS += -DBUILD_FREETYPE $(FREETYPE_CFLAGS)
  894. RENDERER_LIBS += $(FREETYPE_LIBS)
  895. endif
  896. ifeq ($(USE_AUTOUPDATER),1)
  897. CLIENT_CFLAGS += -DUSE_AUTOUPDATER -DAUTOUPDATER_BIN=\\\"$(AUTOUPDATER_BIN)\\\"
  898. SERVER_CFLAGS += -DUSE_AUTOUPDATER -DAUTOUPDATER_BIN=\\\"$(AUTOUPDATER_BIN)\\\"
  899. endif
  900. ifeq ($(BUILD_AUTOUPDATER),1)
  901. AUTOUPDATER_LIBS += $(LIBTOMCRYPTSRCDIR)/libtomcrypt.a $(TOMSFASTMATHSRCDIR)/libtfm.a
  902. endif
  903. ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
  904. BASE_CFLAGS += -Qunused-arguments
  905. endif
  906. ifeq ($(USE_AUTH),1)
  907. BASE_CFLAGS += -DUSE_AUTH=1
  908. endif
  909. ifeq ($(USE_SKEETMOD),1)
  910. BASE_CFLAGS += -DUSE_SKEETMOD=1
  911. endif
  912. ifeq ($(USE_DEMO_FORMAT_42),1)
  913. BASE_CFLAGS += -DUSE_DEMO_FORMAT_42=1
  914. endif
  915. ifdef DEFAULT_BASEDIR
  916. BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
  917. endif
  918. ifdef DEFAULT_HOMEDIR
  919. BASE_CFLAGS += -DDEFAULT_HOMEDIR=\\\"$(DEFAULT_HOMEDIR)\\\"
  920. endif
  921. ifeq ($(USE_LOCAL_HEADERS),1)
  922. BASE_CFLAGS += -DUSE_LOCAL_HEADERS
  923. endif
  924. ifeq ($(GENERATE_DEPENDENCIES),1)
  925. DEPEND_CFLAGS = -MMD
  926. else
  927. DEPEND_CFLAGS =
  928. endif
  929. ifeq ($(NO_STRIP),1)
  930. STRIP_FLAG =
  931. else
  932. STRIP_FLAG = -s
  933. endif
  934. # https://reproducible-builds.org/specs/source-date-epoch/
  935. ifdef SOURCE_DATE_EPOCH
  936. BASE_CFLAGS += -DPRODUCT_DATE=\\\"$(shell date --date="@$$SOURCE_DATE_EPOCH" "+%b %_d %Y" | sed -e 's/ /\\\ /'g)\\\"
  937. endif
  938. BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
  939. BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral
  940. BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute
  941. BASE_CFLAGS += -Wdisabled-optimization
  942. BASE_CFLAGS += -Werror-implicit-function-declaration
  943. ifeq ($(V),1)
  944. echo_cmd=@:
  945. Q=
  946. else
  947. echo_cmd=@echo
  948. Q=@
  949. endif
  950. define DO_CC
  951. $(echo_cmd) "CC $<"
  952. $(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $<
  953. endef
  954. define DO_CC_ALTIVEC
  955. $(echo_cmd) "CC $<"
  956. $(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) $(ALTIVEC_CFLAGS) -o $@ -c $<
  957. endef
  958. define DO_REF_CC
  959. $(echo_cmd) "REF_CC $<"
  960. $(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $<
  961. endef
  962. define DO_REF_CC_ALTIVEC
  963. $(echo_cmd) "REF_CC $<"
  964. $(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) $(ALTIVEC_CFLAGS) -o $@ -c $<
  965. endef
  966. define DO_REF_STR
  967. $(echo_cmd) "REF_STR $<"
  968. $(Q)rm -f $@
  969. $(Q)echo "const char *fallbackShader_$(notdir $(basename $<)) =" >> $@
  970. $(Q)cat $< | sed -e 's/^/\"/;s/$$/\\n\"/' | tr -d '\r' >> $@
  971. $(Q)echo ";" >> $@
  972. endef
  973. define DO_BOT_CC
  974. $(echo_cmd) "BOT_CC $<"
  975. $(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) $(OPTIMIZE) -DBOTLIB -o $@ -c $<
  976. endef
  977. ifeq ($(GENERATE_DEPENDENCIES),1)
  978. DO_QVM_DEP=cat $(@:%.o=%.d) | sed -e 's/\.o/\.asm/g' >> $(@:%.o=%.d)
  979. endif
  980. define DO_AS
  981. $(echo_cmd) "AS $<"
  982. $(Q)$(CC) $(CFLAGS) $(OPTIMIZE) -x assembler-with-cpp -o $@ -c $<
  983. endef
  984. define DO_DED_CC
  985. $(echo_cmd) "DED_CC $<"
  986. $(Q)$(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) $(SERVER_CFLAGS) $(OPTIMIZE) -o $@ -c $<
  987. endef
  988. define DO_WINDRES
  989. $(echo_cmd) "WINDRES $<"
  990. $(Q)$(WINDRES) -i $< -o $@
  991. endef
  992. #############################################################################
  993. # MAIN TARGETS
  994. #############################################################################
  995. default: release
  996. all: debug release
  997. debug:
  998. @$(MAKE) BUILD_TYPE=debug targets B=$(BD) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \
  999. OPTIMIZE="$(DEBUG_CFLAGS)" OPTIMIZEVM="$(DEBUG_CFLAGS)" \
  1000. CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V)
  1001. release:
  1002. @$(MAKE) BUILD_TYPE=release targets B=$(BR) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \
  1003. OPTIMIZE="-DNDEBUG $(OPTIMIZE)" OPTIMIZEVM="-DNDEBUG $(OPTIMIZEVM)" \
  1004. CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V)
  1005. ifneq ($(call bin_path, tput),)
  1006. TERM_COLUMNS=$(shell if c=`tput cols`; then echo $$(($$c-4)); else echo 76; fi)
  1007. else
  1008. TERM_COLUMNS=76
  1009. endif
  1010. define ADD_COPY_TARGET
  1011. TARGETS += $2
  1012. $2: $1
  1013. $(echo_cmd) "CP $$<"
  1014. @cp $1 $2
  1015. endef
  1016. # These functions allow us to generate rules for copying a list of files
  1017. # into the base directory of the build; this is useful for bundling libs,
  1018. # README files or whatever else
  1019. define GENERATE_COPY_TARGETS
  1020. $(foreach FILE,$1, \
  1021. $(eval $(call ADD_COPY_TARGET, \
  1022. $(FILE), \
  1023. $(addprefix $(B)/,$(notdir $(FILE))))))
  1024. endef
  1025. $(call GENERATE_COPY_TARGETS,$(EXTRA_FILES))
  1026. ifneq ($(BUILD_CLIENT),0)
  1027. $(call GENERATE_COPY_TARGETS,$(CLIENT_EXTRA_FILES))
  1028. endif
  1029. NAKED_TARGETS=$(shell echo $(TARGETS) | sed -e "s!$(B)/!!g")
  1030. print_list=-@for i in $(1); \
  1031. do \
  1032. echo " $$i"; \
  1033. done
  1034. ifneq ($(call bin_path, fmt),)
  1035. print_wrapped=@echo $(1) | fmt -w $(TERM_COLUMNS) | sed -e "s/^\(.*\)$$/ \1/"
  1036. else
  1037. print_wrapped=$(print_list)
  1038. endif
  1039. # Create the build directories, check libraries and print out
  1040. # an informational message, then start building
  1041. targets: makedirs
  1042. @echo ""
  1043. @echo "Building in $(B):"
  1044. @echo " PLATFORM: $(PLATFORM)"
  1045. @echo " ARCH: $(ARCH)"
  1046. @echo " VERSION: $(VERSION)"
  1047. @echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)"
  1048. @echo " COMPILE_ARCH: $(COMPILE_ARCH)"
  1049. @echo " HAVE_VM_COMPILED: $(HAVE_VM_COMPILED)"
  1050. @echo " PKG_CONFIG: $(PKG_CONFIG)"
  1051. @echo " CC: $(CC)"
  1052. ifeq ($(PLATFORM),mingw32)
  1053. @echo " WINDRES: $(WINDRES)"
  1054. endif
  1055. @echo ""
  1056. @echo " CFLAGS:"
  1057. $(call print_wrapped, $(CFLAGS) $(OPTIMIZE))
  1058. @echo ""
  1059. @echo " CLIENT_CFLAGS:"
  1060. $(call print_wrapped, $(CLIENT_CFLAGS))
  1061. @echo ""
  1062. @echo " SERVER_CFLAGS:"
  1063. $(call print_wrapped, $(SERVER_CFLAGS))
  1064. @echo ""
  1065. @echo " LDFLAGS:"
  1066. $(call print_wrapped, $(LDFLAGS))
  1067. @echo ""
  1068. @echo " LIBS:"
  1069. $(call print_wrapped, $(LIBS))
  1070. @echo ""
  1071. @echo " CLIENT_LIBS:"
  1072. $(call print_wrapped, $(CLIENT_LIBS))
  1073. @echo ""
  1074. @echo " AUTOUPDATER_LIBS:"
  1075. $(call print_wrapped, $(AUTOUPDATER_LIBS))
  1076. @echo ""
  1077. @echo " Output:"
  1078. $(call print_list, $(NAKED_TARGETS))
  1079. @echo ""
  1080. ifneq ($(TARGETS),)
  1081. ifndef DEBUG_MAKEFILE
  1082. @$(MAKE) $(TARGETS) $(B).zip V=$(V)
  1083. endif
  1084. endif
  1085. $(B).zip: $(TARGETS)
  1086. ifeq ($(PLATFORM),darwin)
  1087. ifdef ARCHIVE
  1088. ./make-macosx-app.sh $(BUILD_TYPE)
  1089. endif
  1090. endif
  1091. ifneq ($(PLATFORM),darwin)
  1092. ifdef ARCHIVE
  1093. @rm -f $@
  1094. @(cd $(B) && zip -r9 ../../$@ $(NAKED_TARGETS))
  1095. endif
  1096. endif
  1097. makedirs:
  1098. @$(MKDIR) $(B)/autoupdater
  1099. @$(MKDIR) $(B)/client/opus
  1100. @$(MKDIR) $(B)/client/vorbis
  1101. @$(MKDIR) $(B)/renderergl1
  1102. @$(MKDIR) $(B)/renderergl2
  1103. @$(MKDIR) $(B)/renderergl2/glsl
  1104. @$(MKDIR) $(B)/ded
  1105. #############################################################################
  1106. # AUTOUPDATER
  1107. #############################################################################
  1108. define DO_AUTOUPDATER_CC
  1109. $(echo_cmd) "AUTOUPDATER_CC $<"
  1110. $(Q)$(CC) $(CFLAGS) -I$(LIBTOMCRYPTSRCDIR)/src/headers -I$(TOMSFASTMATHSRCDIR)/src/headers $(CURL_CFLAGS) -o $@ -c $<
  1111. endef
  1112. Q3AUTOUPDATEROBJ = \
  1113. $(B)/autoupdater/autoupdater.o
  1114. $(B)/autoupdater/%.o: $(AUTOUPDATERSRCDIR)/%.c
  1115. $(DO_AUTOUPDATER_CC)
  1116. $(B)/$(AUTOUPDATER_BIN): $(Q3AUTOUPDATEROBJ)
  1117. $(echo_cmd) "AUTOUPDATER_LD $@"
  1118. $(Q)$(CC) $(LDFLAGS) -o $@ $(Q3AUTOUPDATEROBJ) $(AUTOUPDATER_LIBS)
  1119. #############################################################################
  1120. # CLIENT/SERVER
  1121. #############################################################################
  1122. Q3OBJ = \
  1123. $(B)/client/cl_cgame.o \
  1124. $(B)/client/cl_cin.o \
  1125. $(B)/client/cl_console.o \
  1126. $(B)/client/cl_input.o \
  1127. $(B)/client/cl_keys.o \
  1128. $(B)/client/cl_main.o \
  1129. $(B)/client/cl_net_chan.o \
  1130. $(B)/client/cl_parse.o \
  1131. $(B)/client/cl_scrn.o \
  1132. $(B)/client/cl_ui.o \
  1133. $(B)/client/cl_avi.o \
  1134. \
  1135. $(B)/client/cm_load.o \
  1136. $(B)/client/cm_patch.o \
  1137. $(B)/client/cm_polylib.o \
  1138. $(B)/client/cm_test.o \
  1139. $(B)/client/cm_trace.o \
  1140. \
  1141. $(B)/client/cmd.o \
  1142. $(B)/client/common.o \
  1143. $(B)/client/cvar.o \
  1144. $(B)/client/files.o \
  1145. $(B)/client/md4.o \
  1146. $(B)/client/md5.o \
  1147. $(B)/client/msg.o \
  1148. $(B)/client/net_chan.o \
  1149. $(B)/client/net_ip.o \
  1150. $(B)/client/huffman.o \
  1151. \
  1152. $(B)/client/snd_altivec.o \
  1153. $(B)/client/snd_adpcm.o \
  1154. $(B)/client/snd_dma.o \
  1155. $(B)/client/snd_dmahd.o \
  1156. $(B)/client/snd_mem.o \
  1157. $(B)/client/snd_mix.o \
  1158. $(B)/client/snd_wavelet.o \
  1159. \
  1160. $(B)/client/snd_main.o \
  1161. $(B)/client/snd_codec.o \
  1162. $(B)/client/snd_codec_wav.o \
  1163. $(B)/client/snd_codec_ogg.o \
  1164. $(B)/client/snd_codec_opus.o \
  1165. \
  1166. $(B)/client/qal.o \
  1167. $(B)/client/snd_openal.o \
  1168. \
  1169. $(B)/client/cl_curl.o \
  1170. \
  1171. $(B)/client/sv_bot.o \
  1172. $(B)/client/sv_ccmds.o \
  1173. $(B)/client/sv_client.o \
  1174. $(B)/client/sv_game.o \
  1175. $(B)/client/sv_init.o \
  1176. $(B)/client/sv_main.o \
  1177. $(B)/client/sv_net_chan.o \
  1178. $(B)/client/sv_skeetshoot.o \
  1179. $(B)/client/sv_snapshot.o \
  1180. $(B)/client/sv_utils.o \
  1181. $(B)/client/sv_world.o \
  1182. \
  1183. $(B)/client/q_math.o \
  1184. $(B)/client/q_shared.o \
  1185. \
  1186. $(B)/client/unzip.o \
  1187. $(B)/client/ioapi.o \
  1188. $(B)/client/puff.o \
  1189. $(B)/client/vm.o \
  1190. $(B)/client/vm_interpreted.o \
  1191. \
  1192. $(B)/client/be_aas_bspq3.o \
  1193. $(B)/client/be_aas_cluster.o \
  1194. $(B)/client/be_aas_debug.o \
  1195. $(B)/client/be_aas_entity.o \
  1196. $(B)/client/be_aas_file.o \
  1197. $(B)/client/be_aas_main.o \
  1198. $(B)/client/be_aas_move.o \
  1199. $(B)/client/be_aas_optimize.o \
  1200. $(B)/client/be_aas_reach.o \
  1201. $(B)/client/be_aas_route.o \
  1202. $(B)/client/be_aas_routealt.o \
  1203. $(B)/client/be_aas_sample.o \
  1204. $(B)/client/be_ai_char.o \
  1205. $(B)/client/be_ai_chat.o \
  1206. $(B)/client/be_ai_gen.o \
  1207. $(B)/client/be_ai_goal.o \
  1208. $(B)/client/be_ai_move.o \
  1209. $(B)/client/be_ai_weap.o \
  1210. $(B)/client/be_ai_weight.o \
  1211. $(B)/client/be_ea.o \
  1212. $(B)/client/be_interface.o \
  1213. $(B)/client/l_crc.o \
  1214. $(B)/client/l_libvar.o \
  1215. $(B)/client/l_log.o \
  1216. $(B)/client/l_memory.o \
  1217. $(B)/client/l_precomp.o \
  1218. $(B)/client/l_script.o \
  1219. $(B)/client/l_struct.o \
  1220. \
  1221. $(B)/client/sdl_input.o \
  1222. $(B)/client/sdl_snd.o \
  1223. \
  1224. $(B)/client/con_log.o \
  1225. $(B)/client/sys_autoupdater.o \
  1226. $(B)/client/sys_main.o
  1227. ifdef MINGW
  1228. Q3OBJ += \
  1229. $(B)/client/con_win32.o
  1230. else
  1231. Q3OBJ += \
  1232. $(B)/client/con_tty.o
  1233. endif
  1234. Q3R2OBJ = \
  1235. $(B)/renderergl2/tr_animation.o \
  1236. $(B)/renderergl2/tr_backend.o \
  1237. $(B)/renderergl2/tr_bsp.o \
  1238. $(B)/renderergl2/tr_cmds.o \
  1239. $(B)/renderergl2/tr_curve.o \
  1240. $(B)/renderergl2/tr_dsa.o \
  1241. $(B)/renderergl2/tr_extramath.o \
  1242. $(B)/renderergl2/tr_extensions.o \
  1243. $(B)/renderergl2/tr_fbo.o \
  1244. $(B)/renderergl2/tr_flares.o \
  1245. $(B)/renderergl2/tr_font.o \
  1246. $(B)/renderergl2/tr_glsl.o \
  1247. $(B)/renderergl2/tr_image.o \
  1248. $(B)/renderergl2/tr_image_bmp.o \
  1249. $(B)/renderergl2/tr_image_jpg.o \
  1250. $(B)/renderergl2/tr_image_pcx.o \
  1251. $(B)/renderergl2/tr_image_png.o \
  1252. $(B)/renderergl2/tr_image_tga.o \
  1253. $(B)/renderergl2/tr_image_dds.o \
  1254. $(B)/renderergl2/tr_init.o \
  1255. $(B)/renderergl2/tr_light.o \
  1256. $(B)/renderergl2/tr_main.o \
  1257. $(B)/renderergl2/tr_marks.o \
  1258. $(B)/renderergl2/tr_mesh.o \
  1259. $(B)/renderergl2/tr_model.o \
  1260. $(B)/renderergl2/tr_model_iqm.o \
  1261. $(B)/renderergl2/tr_noise.o \
  1262. $(B)/renderergl2/tr_postprocess.o \
  1263. $(B)/renderergl2/tr_scene.o \
  1264. $(B)/renderergl2/tr_shade.o \
  1265. $(B)/renderergl2/tr_shade_calc.o \
  1266. $(B)/renderergl2/tr_shader.o \
  1267. $(B)/renderergl2/tr_shadows.o \
  1268. $(B)/renderergl2/tr_sky.o \
  1269. $(B)/renderergl2/tr_surface.o \
  1270. $(B)/renderergl2/tr_vbo.o \
  1271. $(B)/renderergl2/tr_world.o \
  1272. \
  1273. $(B)/renderergl1/sdl_gamma.o \
  1274. $(B)/renderergl1/sdl_glimp.o
  1275. Q3R2STRINGOBJ = \
  1276. $(B)/renderergl2/glsl/bokeh_fp.o \
  1277. $(B)/renderergl2/glsl/bokeh_vp.o \
  1278. $(B)/renderergl2/glsl/calclevels4x_fp.o \
  1279. $(B)/renderergl2/glsl/calclevels4x_vp.o \
  1280. $(B)/renderergl2/glsl/depthblur_fp.o \
  1281. $(B)/renderergl2/glsl/depthblur_vp.o \
  1282. $(B)/renderergl2/glsl/dlight_fp.o \
  1283. $(B)/renderergl2/glsl/dlight_vp.o \
  1284. $(B)/renderergl2/glsl/down4x_fp.o \
  1285. $(B)/renderergl2/glsl/down4x_vp.o \
  1286. $(B)/renderergl2/glsl/fogpass_fp.o \
  1287. $(B)/renderergl2/glsl/fogpass_vp.o \
  1288. $(B)/renderergl2/glsl/generic_fp.o \
  1289. $(B)/renderergl2/glsl/generic_vp.o \
  1290. $(B)/renderergl2/glsl/lightall_fp.o \
  1291. $(B)/renderergl2/glsl/lightall_vp.o \
  1292. $(B)/renderergl2/glsl/pshadow_fp.o \
  1293. $(B)/renderergl2/glsl/pshadow_vp.o \
  1294. $(B)/renderergl2/glsl/shadowfill_fp.o \
  1295. $(B)/renderergl2/glsl/shadowfill_vp.o \
  1296. $(B)/renderergl2/glsl/shadowmask_fp.o \
  1297. $(B)/renderergl2/glsl/shadowmask_vp.o \
  1298. $(B)/renderergl2/glsl/ssao_fp.o \
  1299. $(B)/renderergl2/glsl/ssao_vp.o \
  1300. $(B)/renderergl2/glsl/texturecolor_fp.o \
  1301. $(B)/renderergl2/glsl/texturecolor_vp.o \
  1302. $(B)/renderergl2/glsl/tonemap_fp.o \
  1303. $(B)/renderergl2/glsl/tonemap_vp.o
  1304. Q3ROBJ = \
  1305. $(B)/renderergl1/tr_altivec.o \
  1306. $(B)/renderergl1/tr_animation.o \
  1307. $(B)/renderergl1/tr_backend.o \
  1308. $(B)/renderergl1/tr_bsp.o \
  1309. $(B)/renderergl1/tr_cmds.o \
  1310. $(B)/renderergl1/tr_curve.o \
  1311. $(B)/renderergl1/tr_flares.o \
  1312. $(B)/renderergl1/tr_font.o \
  1313. $(B)/renderergl1/tr_image.o \
  1314. $(B)/renderergl1/tr_image_bmp.o \
  1315. $(B)/renderergl1/tr_image_jpg.o \
  1316. $(B)/renderergl1/tr_image_pcx.o \
  1317. $(B)/renderergl1/tr_image_png.o \
  1318. $(B)/renderergl1/tr_image_tga.o \
  1319. $(B)/renderergl1/tr_init.o \
  1320. $(B)/renderergl1/tr_light.o \
  1321. $(B)/renderergl1/tr_main.o \
  1322. $(B)/renderergl1/tr_marks.o \
  1323. $(B)/renderergl1/tr_mesh.o \
  1324. $(B)/renderergl1/tr_model.o \
  1325. $(B)/renderergl1/tr_model_iqm.o \
  1326. $(B)/renderergl1/tr_noise.o \
  1327. $(B)/renderergl1/tr_scene.o \
  1328. $(B)/renderergl1/tr_shade.o \
  1329. $(B)/renderergl1/tr_shade_calc.o \
  1330. $(B)/renderergl1/tr_shader.o \
  1331. $(B)/renderergl1/tr_shadows.o \
  1332. $(B)/renderergl1/tr_sky.o \
  1333. $(B)/renderergl1/tr_surface.o \
  1334. $(B)/renderergl1/tr_world.o \
  1335. \
  1336. $(B)/renderergl1/sdl_gamma.o \
  1337. $(B)/renderergl1/sdl_glimp.o
  1338. ifneq ($(USE_RENDERER_DLOPEN), 0)
  1339. Q3ROBJ += \
  1340. $(B)/renderergl1/q_shared.o \
  1341. $(B)/renderergl1/puff.o \
  1342. $(B)/renderergl1/q_math.o \
  1343. $(B)/renderergl1/tr_subs.o
  1344. Q3R2OBJ += \
  1345. $(B)/renderergl1/q_shared.o \
  1346. $(B)/renderergl1/puff.o \
  1347. $(B)/renderergl1/q_math.o \
  1348. $(B)/renderergl1/tr_subs.o
  1349. endif
  1350. ifneq ($(USE_INTERNAL_JPEG),0)
  1351. JPGOBJ = \
  1352. $(B)/renderergl1/jaricom.o \
  1353. $(B)/renderergl1/jcapimin.o \
  1354. $(B)/renderergl1/jcapistd.o \
  1355. $(B)/renderergl1/jcarith.o \
  1356. $(B)/renderergl1/jccoefct.o \
  1357. $(B)/renderergl1/jccolor.o \
  1358. $(B)/renderergl1/jcdctmgr.o \
  1359. $(B)/renderergl1/jchuff.o \
  1360. $(B)/renderergl1/jcinit.o \
  1361. $(B)/renderergl1/jcmainct.o \
  1362. $(B)/renderergl1/jcmarker.o \
  1363. $(B)/renderergl1/jcmaster.o \
  1364. $(B)/renderergl1/jcomapi.o \
  1365. $(B)/renderergl1/jcparam.o \
  1366. $(B)/renderergl1/jcprepct.o \
  1367. $(B)/renderergl1/jcsample.o \
  1368. $(B)/renderergl1/jctrans.o \
  1369. $(B)/renderergl1/jdapimin.o \
  1370. $(B)/renderergl1/jdapistd.o \
  1371. $(B)/renderergl1/jdarith.o \
  1372. $(B)/renderergl1/jdatadst.o \
  1373. $(B)/renderergl1/jdatasrc.o \
  1374. $(B)/renderergl1/jdcoefct.o \
  1375. $(B)/renderergl1/jdcolor.o \
  1376. $(B)/renderergl1/jddctmgr.o \
  1377. $(B)/renderergl1/jdhuff.o \
  1378. $(B)/renderergl1/jdinput.o \
  1379. $(B)/renderergl1/jdmainct.o \
  1380. $(B)/renderergl1/jdmarker.o \
  1381. $(B)/renderergl1/jdmaster.o \
  1382. $(B)/renderergl1/jdmerge.o \
  1383. $(B)/renderergl1/jdpostct.o \
  1384. $(B)/renderergl1/jdsample.o \
  1385. $(B)/renderergl1/jdtrans.o \
  1386. $(B)/renderergl1/jerror.o \
  1387. $(B)/renderergl1/jfdctflt.o \
  1388. $(B)/renderergl1/jfdctfst.o \
  1389. $(B)/renderergl1/jfdctint.o \
  1390. $(B)/renderergl1/jidctflt.o \
  1391. $(B)/renderergl1/jidctfst.o \
  1392. $(B)/renderergl1/jidctint.o \
  1393. $(B)/renderergl1/jmemmgr.o \
  1394. $(B)/renderergl1/jmemnobs.o \
  1395. $(B)/renderergl1/jquant1.o \
  1396. $(B)/renderergl1/jquant2.o \
  1397. $(B)/renderergl1/jutils.o
  1398. endif
  1399. ifeq ($(ARCH),x86)
  1400. Q3OBJ += \
  1401. $(B)/client/snd_mixa.o \
  1402. $(B)/client/matha.o \
  1403. $(B)/client/snapvector.o \
  1404. $(B)/client/ftola.o
  1405. endif
  1406. ifeq ($(ARCH),x86_64)
  1407. Q3OBJ += \
  1408. $(B)/client/snapvector.o \
  1409. $(B)/client/ftola.o
  1410. endif
  1411. ifeq ($(NEED_OPUS),1)
  1412. ifeq ($(USE_INTERNAL_OPUS),1)
  1413. Q3OBJ += \
  1414. $(B)/client/opus/analysis.o \
  1415. $(B)/client/opus/mlp.o \
  1416. $(B)/client/opus/mlp_data.o \
  1417. $(B)/client/opus/opus.o \
  1418. $(B)/client/opus/opus_decoder.o \
  1419. $(B)/client/opus/opus_encoder.o \
  1420. $(B)/client/opus/opus_multistream.o \
  1421. $(B)/client/opus/opus_multistream_encoder.o \
  1422. $(B)/client/opus/opus_multistream_decoder.o \
  1423. $(B)/client/opus/repacketizer.o \
  1424. \
  1425. $(B)/client/opus/bands.o \
  1426. $(B)/client/opus/celt.o \
  1427. $(B)/client/opus/cwrs.o \
  1428. $(B)/client/opus/entcode.o \
  1429. $(B)/client/opus/entdec.o \
  1430. $(B)/client/opus/entenc.o \
  1431. $(B)/client/opus/kiss_fft.o \
  1432. $(B)/client/opus/laplace.o \
  1433. $(B)/client/opus/mathops.o \
  1434. $(B)/client/opus/mdct.o \
  1435. $(B)/client/opus/modes.o \
  1436. $(B)/client/opus/pitch.o \
  1437. $(B)/client/opus/celt_encoder.o \
  1438. $(B)/client/opus/celt_decoder.o \
  1439. $(B)/client/opus/celt_lpc.o \
  1440. $(B)/client/opus/quant_bands.o \
  1441. $(B)/client/opus/rate.o \
  1442. $(B)/client/opus/vq.o \
  1443. \
  1444. $(B)/client/opus/CNG.o \
  1445. $(B)/client/opus/code_signs.o \
  1446. $(B)/client/opus/init_decoder.o \
  1447. $(B)/client/opus/decode_core.o \
  1448. $(B)/client/opus/decode_frame.o \
  1449. $(B)/client/opus/decode_parameters.o \
  1450. $(B)/client/opus/decode_indices.o \
  1451. $(B)/client/opus/decode_pulses.o \
  1452. $(B)/client/opus/decoder_set_fs.o \
  1453. $(B)/client/opus/dec_API.o \
  1454. $(B)/client/opus/enc_API.o \
  1455. $(B)/client/opus/encode_indices.o \
  1456. $(B)/client/opus/encode_pulses.o \
  1457. $(B)/client/opus/gain_quant.o \
  1458. $(B)/client/opus/interpolate.o \
  1459. $(B)/client/opus/LP_variable_cutoff.o \
  1460. $(B)/client/opus/NLSF_decode.o \
  1461. $(B)/client/opus/NSQ.o \
  1462. $(B)/client/opus/NSQ_del_dec.o \
  1463. $(B)/client/opus/PLC.o \
  1464. $(B)/client/opus/shell_coder.o \
  1465. $(B)/client/opus/tables_gain.o \
  1466. $(B)/client/opus/tables_LTP.o \
  1467. $(B)/client/opus/tables_NLSF_CB_NB_MB.o \
  1468. $(B)/client/opus/tables_NLSF_CB_WB.o \
  1469. $(B)/client/opus/tables_other.o \
  1470. $(B)/client/opus/tables_pitch_lag.o \
  1471. $(B)/client/opus/tables_pulses_per_block.o \
  1472. $(B)/client/opus/VAD.o \
  1473. $(B)/client/opus/control_audio_bandwidth.o \
  1474. $(B)/client/opus/quant_LTP_gains.o \
  1475. $(B)/client/opus/VQ_WMat_EC.o \
  1476. $(B)/client/opus/HP_variable_cutoff.o \
  1477. $(B)/client/opus/NLSF_encode.o \
  1478. $(B)/client/opus/NLSF_VQ.o \
  1479. $(B)/client/opus/NLSF_unpack.o \
  1480. $(B)/client/opus/NLSF_del_dec_quant.o \
  1481. $(B)/client/opus/process_NLSFs.o \
  1482. $(B)/client/opus/stereo_LR_to_MS.o \
  1483. $(B)/client/opus/stereo_MS_to_LR.o \
  1484. $(B)/client/opus/check_control_input.o \
  1485. $(B)/client/opus/control_SNR.o \
  1486. $(B)/client/opus/init_encoder.o \
  1487. $(B)/client/opus/control_codec.o \
  1488. $(B)/client/opus/A2NLSF.o \
  1489. $(B)/client/opus/ana_filt_bank_1.o \
  1490. $(B)/client/opus/biquad_alt.o \
  1491. $(B)/client/opus/bwexpander_32.o \
  1492. $(B)/client/opus/bwexpander.o \
  1493. $(B)/client/opus/debug.o \
  1494. $(B)/client/opus/decode_pitch.o \
  1495. $(B)/client/opus/inner_prod_aligned.o \
  1496. $(B)/client/opus/lin2log.o \
  1497. $(B)/client/opus/log2lin.o \
  1498. $(B)/client/opus/LPC_analysis_filter.o \
  1499. $(B)/client/opus/LPC_fit.o \
  1500. $(B)/client/opus/LPC_inv_pred_gain.o \
  1501. $(B)/client/opus/table_LSF_cos.o \
  1502. $(B)/client/opus/NLSF2A.o \
  1503. $(B)/client/opus/NLSF_stabilize.o \
  1504. $(B)/client/opus/NLSF_VQ_weights_laroia.o \
  1505. $(B)/client/opus/pitch_est_tables.o \
  1506. $(B)/client/opus/resampler.o \
  1507. $(B)/client/opus/resampler_down2_3.o \
  1508. $(B)/client/opus/resampler_down2.o \
  1509. $(B)/client/opus/resampler_private_AR2.o \
  1510. $(B)/client/opus/resampler_private_down_FIR.o \
  1511. $(B)/client/opus/resampler_private_IIR_FIR.o \
  1512. $(B)/client/opus/resampler_private_up2_HQ.o \
  1513. $(B)/client/opus/resampler_rom.o \
  1514. $(B)/client/opus/sigm_Q15.o \
  1515. $(B)/client/opus/sort.o \
  1516. $(B)/client/opus/sum_sqr_shift.o \
  1517. $(B)/client/opus/stereo_decode_pred.o \
  1518. $(B)/client/opus/stereo_encode_pred.o \
  1519. $(B)/client/opus/stereo_find_predictor.o \
  1520. $(B)/client/opus/stereo_quant_pred.o \
  1521. \
  1522. $(B)/client/opus/apply_sine_window_FLP.o \
  1523. $(B)/client/opus/corrMatrix_FLP.o \
  1524. $(B)/client/opus/encode_frame_FLP.o \
  1525. $(B)/client/opus/find_LPC_FLP.o \
  1526. $(B)/client/opus/find_LTP_FLP.o \
  1527. $(B)/client/opus/find_pitch_lags_FLP.o \
  1528. $(B)/client/opus/find_pred_coefs_FLP.o \
  1529. $(B)/client/opus/LPC_analysis_filter_FLP.o \
  1530. $(B)/client/opus/LTP_analysis_filter_FLP.o \
  1531. $(B)/client/opus/LTP_scale_ctrl_FLP.o \
  1532. $(B)/client/opus/noise_shape_analysis_FLP.o \
  1533. $(B)/client/opus/process_gains_FLP.o \
  1534. $(B)/client/opus/regularize_correlations_FLP.o \
  1535. $(B)/client/opus/residual_energy_FLP.o \
  1536. $(B)/client/opus/warped_autocorrelation_FLP.o \
  1537. $(B)/client/opus/wrappers_FLP.o \
  1538. $(B)/client/opus/autocorrelation_FLP.o \
  1539. $(B)/client/opus/burg_modified_FLP.o \
  1540. $(B)/client/opus/bwexpander_FLP.o \
  1541. $(B)/client/opus/energy_FLP.o \
  1542. $(B)/client/opus/inner_product_FLP.o \
  1543. $(B)/client/opus/k2a_FLP.o \
  1544. $(B)/client/opus/LPC_inv_pred_gain_FLP.o \
  1545. $(B)/client/opus/pitch_analysis_core_FLP.o \
  1546. $(B)/client/opus/scale_copy_vector_FLP.o \
  1547. $(B)/client/opus/scale_vector_FLP.o \
  1548. $(B)/client/opus/schur_FLP.o \
  1549. $(B)/client/opus/sort_FLP.o \
  1550. \
  1551. $(B)/client/http.o \
  1552. $(B)/client/info.o \
  1553. $(B)/client/internal.o \
  1554. $(B)/client/opusfile.o \
  1555. $(B)/client/stream.o \
  1556. $(B)/client/wincerts.o
  1557. endif
  1558. endif
  1559. ifeq ($(NEED_OGG),1)
  1560. ifeq ($(USE_INTERNAL_OGG),1)
  1561. Q3OBJ += \
  1562. $(B)/client/bitwise.o \
  1563. $(B)/client/framing.o
  1564. endif
  1565. endif
  1566. ifeq ($(USE_CODEC_VORBIS),1)
  1567. ifeq ($(USE_INTERNAL_VORBIS),1)
  1568. Q3OBJ += \
  1569. $(B)/client/vorbis/analysis.o \
  1570. $(B)/client/vorbis/bitrate.o \
  1571. $(B)/client/vorbis/block.o \
  1572. $(B)/client/vorbis/codebook.o \
  1573. $(B)/client/vorbis/envelope.o \
  1574. $(B)/client/vorbis/floor0.o \
  1575. $(B)/client/vorbis/floor1.o \
  1576. $(B)/client/vorbis/info.o \
  1577. $(B)/client/vorbis/lookup.o \
  1578. $(B)/client/vorbis/lpc.o \
  1579. $(B)/client/vorbis/lsp.o \
  1580. $(B)/client/vorbis/mapping0.o \
  1581. $(B)/client/vorbis/mdct.o \
  1582. $(B)/client/vorbis/psy.o \
  1583. $(B)/client/vorbis/registry.o \
  1584. $(B)/client/vorbis/res0.o \
  1585. $(B)/client/vorbis/smallft.o \
  1586. $(B)/client/vorbis/sharedbook.o \
  1587. $(B)/client/vorbis/synthesis.o \
  1588. $(B)/client/vorbis/vorbisfile.o \
  1589. $(B)/client/vorbis/window.o
  1590. endif
  1591. endif
  1592. ifeq ($(USE_INTERNAL_ZLIB),1)
  1593. Q3OBJ += \
  1594. $(B)/client/adler32.o \
  1595. $(B)/client/crc32.o \
  1596. $(B)/client/inffast.o \
  1597. $(B)/client/inflate.o \
  1598. $(B)/client/inftrees.o \
  1599. $(B)/client/zutil.o
  1600. endif
  1601. ifeq ($(HAVE_VM_COMPILED),true)
  1602. ifneq ($(findstring $(ARCH),x86 x86_64),)
  1603. Q3OBJ += \
  1604. $(B)/client/vm_x86.o
  1605. endif
  1606. ifneq ($(findstring $(ARCH),ppc ppc64),)
  1607. Q3OBJ += $(B)/client/vm_powerpc.o $(B)/client/vm_powerpc_asm.o
  1608. endif
  1609. ifeq ($(ARCH),sparc)
  1610. Q3OBJ += $(B)/client/vm_sparc.o
  1611. endif
  1612. ifeq ($(ARCH),armv7l)
  1613. Q3OBJ += $(B)/client/vm_armv7l.o
  1614. endif
  1615. endif
  1616. ifdef MINGW
  1617. Q3OBJ += \
  1618. $(B)/client/win_resource.o \
  1619. $(B)/client/sys_win32.o
  1620. else
  1621. Q3OBJ += \
  1622. $(B)/client/sys_unix.o
  1623. endif
  1624. ifeq ($(PLATFORM),darwin)
  1625. Q3OBJ += \
  1626. $(B)/client/sys_osx.o
  1627. endif
  1628. ifeq ($(USE_MUMBLE),1)
  1629. Q3OBJ += \
  1630. $(B)/client/libmumblelink.o
  1631. endif
  1632. ifneq ($(USE_RENDERER_DLOPEN),0)
  1633. $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN)
  1634. $(echo_cmd) "LD $@"
  1635. $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) \
  1636. -o $@ $(Q3OBJ) \
  1637. $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
  1638. $(B)/renderer_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(JPGOBJ)
  1639. $(echo_cmd) "LD $@"
  1640. $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(JPGOBJ) \
  1641. $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)
  1642. $(B)/renderer_opengl2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ)
  1643. $(echo_cmd) "LD $@"
  1644. $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
  1645. $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)
  1646. else
  1647. $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(LIBSDLMAIN)
  1648. $(echo_cmd) "LD $@"
  1649. $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) \
  1650. -o $@ $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) \
  1651. $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
  1652. $(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(LIBSDLMAIN)
  1653. $(echo_cmd) "LD $@"
  1654. $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) \
  1655. -o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
  1656. $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
  1657. endif
  1658. ifneq ($(strip $(LIBSDLMAIN)),)
  1659. ifneq ($(strip $(LIBSDLMAINSRC)),)
  1660. $(LIBSDLMAIN) : $(LIBSDLMAINSRC)
  1661. cp $< $@
  1662. $(RANLIB) $@
  1663. endif
  1664. endif
  1665. #############################################################################
  1666. # DEDICATED SERVER
  1667. #############################################################################
  1668. Q3DOBJ = \
  1669. $(B)/ded/sv_bot.o \
  1670. $(B)/ded/sv_client.o \
  1671. $(B)/ded/sv_ccmds.o \
  1672. $(B)/ded/sv_game.o \
  1673. $(B)/ded/sv_init.o \
  1674. $(B)/ded/sv_main.o \
  1675. $(B)/ded/sv_net_chan.o \
  1676. $(B)/ded/sv_skeetshoot.o \
  1677. $(B)/ded/sv_snapshot.o \
  1678. $(B)/ded/sv_utils.o \
  1679. $(B)/ded/sv_world.o \
  1680. \
  1681. $(B)/ded/cm_load.o \
  1682. $(B)/ded/cm_patch.o \
  1683. $(B)/ded/cm_polylib.o \
  1684. $(B)/ded/cm_test.o \
  1685. $(B)/ded/cm_trace.o \
  1686. $(B)/ded/cmd.o \
  1687. $(B)/ded/common.o \
  1688. $(B)/ded/cvar.o \
  1689. $(B)/ded/files.o \
  1690. $(B)/ded/md4.o \
  1691. $(B)/ded/msg.o \
  1692. $(B)/ded/net_chan.o \
  1693. $(B)/ded/net_ip.o \
  1694. $(B)/ded/huffman.o \
  1695. \
  1696. $(B)/ded/q_math.o \
  1697. $(B)/ded/q_shared.o \
  1698. \
  1699. $(B)/ded/unzip.o \
  1700. $(B)/ded/ioapi.o \
  1701. $(B)/ded/vm.o \
  1702. $(B)/ded/vm_interpreted.o \
  1703. \
  1704. $(B)/ded/be_aas_bspq3.o \
  1705. $(B)/ded/be_aas_cluster.o \
  1706. $(B)/ded/be_aas_debug.o \
  1707. $(B)/ded/be_aas_entity.o \
  1708. $(B)/ded/be_aas_file.o \
  1709. $(B)/ded/be_aas_main.o \
  1710. $(B)/ded/be_aas_move.o \
  1711. $(B)/ded/be_aas_optimize.o \
  1712. $(B)/ded/be_aas_reach.o \
  1713. $(B)/ded/be_aas_route.o \
  1714. $(B)/ded/be_aas_routealt.o \
  1715. $(B)/ded/be_aas_sample.o \
  1716. $(B)/ded/be_ai_char.o \
  1717. $(B)/ded/be_ai_chat.o \
  1718. $(B)/ded/be_ai_gen.o \
  1719. $(B)/ded/be_ai_goal.o \
  1720. $(B)/ded/be_ai_move.o \
  1721. $(B)/ded/be_ai_weap.o \
  1722. $(B)/ded/be_ai_weight.o \
  1723. $(B)/ded/be_ea.o \
  1724. $(B)/ded/be_interface.o \
  1725. $(B)/ded/l_crc.o \
  1726. $(B)/ded/l_libvar.o \
  1727. $(B)/ded/l_log.o \
  1728. $(B)/ded/l_memory.o \
  1729. $(B)/ded/l_precomp.o \
  1730. $(B)/ded/l_script.o \
  1731. $(B)/ded/l_struct.o \
  1732. \
  1733. $(B)/ded/null_client.o \
  1734. $(B)/ded/null_input.o \
  1735. $(B)/ded/null_snddma.o \
  1736. \
  1737. $(B)/ded/con_log.o \
  1738. $(B)/ded/sys_autoupdater.o \
  1739. $(B)/ded/sys_main.o
  1740. ifeq ($(ARCH),x86)
  1741. Q3DOBJ += \
  1742. $(B)/ded/matha.o \
  1743. $(B)/ded/snapvector.o \
  1744. $(B)/ded/ftola.o
  1745. endif
  1746. ifeq ($(ARCH),x86_64)
  1747. Q3DOBJ += \
  1748. $(B)/ded/snapvector.o \
  1749. $(B)/ded/ftola.o
  1750. endif
  1751. ifeq ($(USE_INTERNAL_ZLIB),1)
  1752. Q3DOBJ += \
  1753. $(B)/ded/adler32.o \
  1754. $(B)/ded/crc32.o \
  1755. $(B)/ded/inffast.o \
  1756. $(B)/ded/inflate.o \
  1757. $(B)/ded/inftrees.o \
  1758. $(B)/ded/zutil.o
  1759. endif
  1760. ifeq ($(HAVE_VM_COMPILED),true)
  1761. ifneq ($(findstring $(ARCH),x86 x86_64),)
  1762. Q3DOBJ += \
  1763. $(B)/ded/vm_x86.o
  1764. endif
  1765. ifneq ($(findstring $(ARCH),ppc ppc64),)
  1766. Q3DOBJ += $(B)/ded/vm_powerpc.o $(B)/ded/vm_powerpc_asm.o
  1767. endif
  1768. ifeq ($(ARCH),sparc)
  1769. Q3DOBJ += $(B)/ded/vm_sparc.o
  1770. endif
  1771. ifeq ($(ARCH),armv7l)
  1772. Q3DOBJ += $(B)/client/vm_armv7l.o
  1773. endif
  1774. endif
  1775. ifdef MINGW
  1776. Q3DOBJ += \
  1777. $(B)/ded/win_resource.o \
  1778. $(B)/ded/sys_win32.o \
  1779. $(B)/ded/con_win32.o
  1780. else
  1781. Q3DOBJ += \
  1782. $(B)/ded/sys_unix.o \
  1783. $(B)/ded/con_tty.o
  1784. endif
  1785. ifeq ($(PLATFORM),darwin)
  1786. Q3DOBJ += \
  1787. $(B)/ded/sys_osx.o
  1788. endif
  1789. $(B)/$(SERVERBIN)$(FULLBINEXT): $(Q3DOBJ)
  1790. $(echo_cmd) "LD $@"
  1791. $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) -o $@ $(Q3DOBJ) $(LIBS)
  1792. #############################################################################
  1793. ## CLIENT/SERVER RULES
  1794. #############################################################################
  1795. $(B)/client/%.o: $(ASMDIR)/%.s
  1796. $(DO_AS)
  1797. # k8 so inline assembler knows about SSE
  1798. $(B)/client/%.o: $(ASMDIR)/%.c
  1799. $(DO_CC) -march=k8
  1800. $(B)/client/snd_altivec.o: $(CDIR)/snd_altivec.c
  1801. $(DO_CC_ALTIVEC)
  1802. $(B)/client/%.o: $(CDIR)/%.c
  1803. $(DO_CC)
  1804. $(B)/client/%.o: $(SDIR)/%.c
  1805. $(DO_CC)
  1806. $(B)/client/%.o: $(CMDIR)/%.c
  1807. $(DO_CC)
  1808. $(B)/client/%.o: $(BLIBDIR)/%.c
  1809. $(DO_BOT_CC)
  1810. $(B)/client/%.o: $(OGGDIR)/src/%.c
  1811. $(DO_CC)
  1812. $(B)/client/vorbis/%.o: $(VORBISDIR)/lib/%.c
  1813. $(DO_CC)
  1814. $(B)/client/opus/%.o: $(OPUSDIR)/src/%.c
  1815. $(DO_CC)
  1816. $(B)/client/opus/%.o: $(OPUSDIR)/celt/%.c
  1817. $(DO_CC)
  1818. $(B)/client/opus/%.o: $(OPUSDIR)/silk/%.c
  1819. $(DO_CC)
  1820. $(B)/client/opus/%.o: $(OPUSDIR)/silk/float/%.c
  1821. $(DO_CC)
  1822. $(B)/client/%.o: $(OPUSFILEDIR)/src/%.c
  1823. $(DO_CC)
  1824. $(B)/client/%.o: $(ZDIR)/%.c
  1825. $(DO_CC)
  1826. $(B)/client/%.o: $(SDLDIR)/%.c
  1827. $(DO_CC)
  1828. $(B)/client/%.o: $(SYSDIR)/%.c
  1829. $(DO_CC)
  1830. $(B)/client/%.o: $(SYSDIR)/%.m
  1831. $(DO_CC)
  1832. $(B)/client/win_resource.o: $(SYSDIR)/win_resource.rc $(SYSDIR)/win_manifest.xml
  1833. $(DO_WINDRES)
  1834. $(B)/renderergl1/%.o: $(CMDIR)/%.c
  1835. $(DO_REF_CC)
  1836. $(B)/renderergl1/%.o: $(SDLDIR)/%.c
  1837. $(DO_REF_CC)
  1838. $(B)/renderergl1/%.o: $(JPDIR)/%.c
  1839. $(DO_REF_CC)
  1840. $(B)/renderergl1/%.o: $(RCOMMONDIR)/%.c
  1841. $(DO_REF_CC)
  1842. $(B)/renderergl1/%.o: $(RGL1DIR)/%.c
  1843. $(DO_REF_CC)
  1844. $(B)/renderergl1/tr_altivec.o: $(RGL1DIR)/tr_altivec.c
  1845. $(DO_REF_CC_ALTIVEC)
  1846. $(B)/renderergl2/glsl/%.c: $(RGL2DIR)/glsl/%.glsl
  1847. $(DO_REF_STR)
  1848. $(B)/renderergl2/glsl/%.o: $(B)/renderergl2/glsl/%.c
  1849. $(DO_REF_CC)
  1850. $(B)/renderergl2/%.o: $(RCOMMONDIR)/%.c
  1851. $(DO_REF_CC)
  1852. $(B)/renderergl2/%.o: $(RGL2DIR)/%.c
  1853. $(DO_REF_CC)
  1854. $(B)/ded/%.o: $(ASMDIR)/%.s
  1855. $(DO_AS)
  1856. # k8 so inline assembler knows about SSE
  1857. $(B)/ded/%.o: $(ASMDIR)/%.c
  1858. $(DO_CC) -march=k8
  1859. $(B)/ded/%.o: $(SDIR)/%.c
  1860. $(DO_DED_CC)
  1861. $(B)/ded/%.o: $(CMDIR)/%.c
  1862. $(DO_DED_CC)
  1863. $(B)/ded/%.o: $(ZDIR)/%.c
  1864. $(DO_DED_CC)
  1865. $(B)/ded/%.o: $(BLIBDIR)/%.c
  1866. $(DO_BOT_CC)
  1867. $(B)/ded/%.o: $(SYSDIR)/%.c
  1868. $(DO_DED_CC)
  1869. $(B)/ded/%.o: $(SYSDIR)/%.m
  1870. $(DO_DED_CC)
  1871. $(B)/ded/win_resource.o: $(SYSDIR)/win_resource.rc $(SYSDIR)/win_manifest.xml
  1872. $(DO_WINDRES)
  1873. $(B)/ded/%.o: $(NDIR)/%.c
  1874. $(DO_DED_CC)
  1875. # Extra dependencies to ensure the git version is incorporated
  1876. ifeq ($(USE_GIT),1)
  1877. $(B)/client/cl_console.o : .git
  1878. $(B)/client/common.o : .git
  1879. $(B)/ded/common.o : .git
  1880. endif
  1881. #############################################################################
  1882. # MISC
  1883. #############################################################################
  1884. OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3DOBJ) $(JPGOBJ)
  1885. STRINGOBJ = $(Q3R2STRINGOBJ)
  1886. copyfiles: release
  1887. ifneq ($(BUILD_CLIENT),0)
  1888. $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(CLIENTBIN)$(FULLBINEXT) $(COPYBINDIR)/$(CLIENTBIN)$(FULLBINEXT)
  1889. ifneq ($(USE_RENDERER_DLOPEN),0)
  1890. $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl1_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl1_$(SHLIBNAME)
  1891. ifneq ($(BUILD_RENDERER_OPENGL2),0)
  1892. $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/renderer_opengl2_$(SHLIBNAME) $(COPYBINDIR)/renderer_opengl2_$(SHLIBNAME)
  1893. endif
  1894. else
  1895. ifneq ($(BUILD_RENDERER_OPENGL2),0)
  1896. $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(CLIENTBIN)_opengl2$(FULLBINEXT) $(COPYBINDIR)/$(CLIENTBIN)_opengl2$(FULLBINEXT)
  1897. endif
  1898. endif
  1899. endif
  1900. ifneq ($(BUILD_SERVER),0)
  1901. @if [ -f $(BR)/$(SERVERBIN)$(FULLBINEXT) ]; then \
  1902. $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/$(SERVERBIN)$(FULLBINEXT) $(COPYBINDIR)/$(SERVERBIN)$(FULLBINEXT); \
  1903. fi
  1904. endif
  1905. clean: clean-debug clean-release
  1906. clean-debug:
  1907. @$(MAKE) clean2 B=$(BD)
  1908. clean-release:
  1909. @$(MAKE) clean2 B=$(BR)
  1910. clean2:
  1911. @echo "CLEAN $(B)"
  1912. @rm -f $(OBJ)
  1913. @rm -f $(OBJ_D_FILES)
  1914. @rm -f $(STRINGOBJ)
  1915. @rm -f $(TARGETS)
  1916. distclean: clean
  1917. @rm -rf $(BUILD_DIR)
  1918. dist:
  1919. git archive --format zip --output $(CLIENTBIN)-$(VERSION).zip HEAD
  1920. #############################################################################
  1921. # DEPENDENCIES
  1922. #############################################################################
  1923. ifneq ($(B),)
  1924. OBJ_D_FILES=$(filter %.d,$(OBJ:%.o=%.d))
  1925. -include $(OBJ_D_FILES)
  1926. endif
  1927. .PHONY: all clean clean2 clean-debug clean-release copyfiles \
  1928. debug default dist distclean makedirs \
  1929. release targets \
  1930. $(OBJ_D_FILES)
  1931. # If the target name contains "clean", don't do a parallel build
  1932. ifneq ($(findstring clean, $(MAKECMDGOALS)),)
  1933. .NOTPARALLEL:
  1934. endif