-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
2110 lines (1756 loc) · 47.7 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
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# TremFusion Makefile
#
# GNU Make required
#
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/)
ifeq ($(COMPILE_PLATFORM),sunos)
# Solaris uname and GNU uname differ
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
endif
ifeq ($(COMPILE_PLATFORM),darwin)
# Apple does some things a little differently...
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
endif
ifeq ($(COMPILE_PLATFORM),windowsnt)
# Sometimes msys uname returns this
COMPILE_PLATFORM=mingw32
endif
ifndef BUILD_CLIENT
BUILD_CLIENT = 1
endif
ifndef BUILD_CLIENT_TTY
BUILD_CLIENT_TTY = 1
endif
ifndef BUILD_SERVER
BUILD_SERVER = 1
endif
ifndef BUILD_GAME_SO
BUILD_GAME_SO = 1
endif
ifndef BUILD_GAME_QVM
BUILD_GAME_QVM = 1
endif
#############################################################################
#
# If you require a different configuration from the defaults below, create a
# new file named "Makefile.local" in the same directory as this file and define
# your parameters there. This allows you to change configuration without
# causing problems with keeping up to date with the repository.
#
#############################################################################
-include Makefile.local
ifndef PLATFORM
PLATFORM=$(COMPILE_PLATFORM)
endif
export PLATFORM
ifeq ($(COMPILE_ARCH),powerpc)
COMPILE_ARCH=ppc
endif
ifeq ($(COMPILE_ARCH),powerpc64)
COMPILE_ARCH=ppc64
endif
ifndef ARCH
ARCH=$(COMPILE_ARCH)
endif
export ARCH
ifneq ($(PLATFORM),$(COMPILE_PLATFORM))
CROSS_COMPILING=1
else
CROSS_COMPILING=0
ifneq ($(ARCH),$(COMPILE_ARCH))
CROSS_COMPILING=1
endif
endif
export CROSS_COMPILING
ifndef COPYBINDIR
COPYBINDIR=$(COPYDIR)
endif
ifndef MOUNT_DIR
MOUNT_DIR=src
endif
ifndef BUILD_DIR
BUILD_DIR=build
endif
ifndef GENERATE_DEPENDENCIES
GENERATE_DEPENDENCIES=1
endif
ifndef USE_OPENAL
USE_OPENAL=1
endif
ifndef USE_OPENAL_DLOPEN
USE_OPENAL_DLOPEN=1
endif
ifndef USE_CURL
USE_CURL=1
endif
ifndef USE_CURL_DLOPEN
ifeq ($(PLATFORM),mingw32)
USE_CURL_DLOPEN=0
else
USE_CURL_DLOPEN=1
endif
endif
ifndef USE_CODEC_VORBIS
USE_CODEC_VORBIS=1
endif
ifndef USE_CIN_THEORA
USE_CIN_THEORA=0
endif
ifeq ($(USE_CIN_THEORA),1)
USE_CODEC_VORBIS=1
endif
ifndef USE_CURSES
USE_CURSES=1
endif
ifndef USE_MUMBLE
USE_MUMBLE=1
endif
ifndef USE_VOIP
USE_VOIP=1
endif
ifndef USE_INTERNAL_SPEEX
USE_INTERNAL_SPEEX=1
endif
ifndef USE_INTERNAL_ZLIB
USE_INTERNAL_ZLIB=1
endif
ifndef USE_GEOIP
USE_GEOIP=1
endif
ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1
endif
ifndef BUILD_MASTER_SERVER
BUILD_MASTER_SERVER=0
endif
# Disable this on release builds
ifndef USE_SCM_VERSION
USE_SCM_VERSION=1
endif
ifndef USE_FREETYPE
USE_FREETYPE=1
endif
ifndef USE_SSE
ifeq ($(ARCH),x86_64)
USE_SSE=2
else
ifeq ($(ARCH),x86)
USE_SSE=1
else
USE_SSE=0
endif
endif
endif
#############################################################################
BD=$(BUILD_DIR)/debug-$(PLATFORM)-$(ARCH)
BR=$(BUILD_DIR)/release-$(PLATFORM)-$(ARCH)
CDIR=$(MOUNT_DIR)/client
SDIR=$(MOUNT_DIR)/server
RDIR=$(MOUNT_DIR)/renderer
CMDIR=$(MOUNT_DIR)/qcommon
SDLDIR=$(MOUNT_DIR)/sdl
ASMDIR=$(MOUNT_DIR)/asm
SYSDIR=$(MOUNT_DIR)/sys
NDIR=$(MOUNT_DIR)/null
UIDIR=$(MOUNT_DIR)/ui
GDIR=$(MOUNT_DIR)/game
JPDIR=$(MOUNT_DIR)/jpeg-6b
SPEEXDIR=$(MOUNT_DIR)/libspeex
Q3ASMDIR=$(MOUNT_DIR)/tools/asm
LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg
Q3LCCETCDIR=$(MOUNT_DIR)/tools/lcc/etc
Q3LCCSRCDIR=$(MOUNT_DIR)/tools/lcc/src
SDLHDIR=$(MOUNT_DIR)/SDL12
ZDIR=$(MOUNT_DIR)/zlib
OGGDIR=$(MOUNT_DIR)/ogg_vorbis
FTDIR=$(MOUNT_DIR)/freetype2
PDCDIR=$(MOUNT_DIR)/pdcurses
LIBSDIR=$(MOUNT_DIR)/libs
MASTERDIR=$(MOUNT_DIR)/master
GEOIPDIR=$(MOUNT_DIR)/GeoIP
TEMPDIR=/tmp
bin_path=$(shell which $(1) 2> /dev/null)
# We won't need this if we only build the server
ifneq ($(BUILD_CLIENT),0)
# set PKG_CONFIG_PATH to influence this, e.g.
# PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig
ifneq ($(call bin_path, pkg-config),)
CURL_CFLAGS=$(shell pkg-config --silence-errors --cflags libcurl)
CURL_LIBS=$(shell pkg-config --silence-errors --libs libcurl)
OPENAL_CFLAGS=$(shell pkg-config --silence-errors --cflags openal)
OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal)
# FIXME: introduce CLIENT_CFLAGS
SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl|sed 's/-Dmain=SDL_main//')
SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl)
OGG_CFLAGS=$(shell pkg-config --silence-errors --cflags ogg vorbis vorbisfile)
OGG_LIBS=$(shell pkg-config --silence-errors --libs ogg vorbis vorbisfile)
# Some distros still use the old pkgconfig string
THEORA_CFLAGS=$(shell pkg-config --silence-errors --cflags theoradec)
THEORA_LIBS=$(shell pkg-config --silence-errors --libs theoradec)
ifeq ($(THEORA_LIBS),)
THEORA_CFLAGS=$(shell pkg-config --silence-errors --cflags theora)
THEORA_LIBS=$(shell pkg-config --silence-errors --libs theora)
endif
endif
# Use sdl-config if all else fails
ifeq ($(SDL_CFLAGS),)
ifneq ($(call bin_path, sdl-config),)
SDL_CFLAGS=$(shell sdl-config --cflags)
SDL_LIBS=$(shell sdl-config --libs)
endif
endif
else
# We still need curl for the tty client
ifeq ($(shell which pkg-config > /dev/null; echo $$?),0)
CURL_CFLAGS=$(shell pkg-config --cflags libcurl)
CURL_LIBS=$(shell pkg-config --libs libcurl)
endif
endif
# version info
VERSION_NUMBER=0.99r3
ifeq ($(USE_SCM_VERSION),1)
# For svn
ifeq ($(wildcard .svn),.svn)
SVN_REV=$(shell LANG=C svnversion .)
ifneq ($(SVN_REV),)
VERSION=$(VERSION_NUMBER)_R$(SVN_REV)
USE_SVN=1
endif
endif
# For git-svn
ifeq ($(wildcard .git/svn/.metadata),.git/svn/.metadata)
GIT_REV=$(shell LANG=C git svn info | awk '$$1 == "Revision:" {print $$2; exit 0}')
ifneq ($(GIT_REV),)
VERSION=$(VERSION_NUMBER)_R$(GIT_REV)
USE_GIT_SVN=1
endif
endif
# For git
ifeq ($(wildcard .git),.git)
GIT_REV = $(shell LANG=C git show-ref -h -s --abbrev | head -n1)
ifneq ($(GIT_REV),)
VERSION = $(VERSION_NUMBER)_R$(GIT_REV)
USE_GIT = 1
endif
endif
# For hg
ifeq ($(wildcard .hg),.hg)
HG_REV=$(shell LANG=C hg id -n)
ifneq ($(HG_REV),)
VERSION=$(VERSION_NUMBER)_R$(HG_REV)
USE_HG=1
endif
endif
else
VERSION=$(VERSION_NUMBER)
endif
#############################################################################
# SETUP AND BUILD -- LINUX
#############################################################################
## Defaults
LIB=lib
INSTALL=install
MKDIR=mkdir
ifndef BUILDROOT
BUILDROOT = ""
endif
ifndef INSTALL_PREFIX
INSTALL_PREFIX = "/usr/local"
endif
ifndef BINDIR
BINDIR = $(INSTALL_PREFIX)/bin
endif
ifndef LIBDIR
LIBDIR = $(INSTALL_PREFIX)/$(LIB)
endif
ifndef DATADIR
DATADIR = $(INSTALL_PREFIX)/share
endif
ifeq ($(PLATFORM),linux)
ifeq ($(ARCH),alpha)
ARCH=axp
else
ifeq ($(ARCH),x86_64)
LIB=lib64
else
ifeq ($(ARCH),ppc64)
LIB=lib64
else
ifeq ($(ARCH),s390x)
LIB=lib64
endif
endif
endif
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -pipe \
-DUSE_ICON $(SDL_CFLAGS)
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL
ifeq ($(USE_OPENAL_DLOPEN),1)
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN
endif
TTYC_CFLAGS += -UUSE_OPENAL
endif
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -DBUILD_FREETYPE
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(FTDIR)
else
BASE_CFLAGS += $(shell freetype-config --cflags)
endif
TTYC_CFLAGS += -UBUILD_FREETYPE
endif
ifeq ($(USE_CURL),1)
BASE_CFLAGS += -DUSE_CURL
ifeq ($(USE_CURL_DLOPEN),1)
BASE_CFLAGS += -DUSE_CURL_DLOPEN
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(OGG_CFLAGS)
endif
TTYC_CFLAGS += -UUSE_CODEC_VORBIS
endif
ifeq ($(USE_CIN_THEORA),1)
BASE_CFLAGS += -DUSE_CIN_THEORA
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(THEORA_CFLAGS)
endif
TTYC_CFLAGS += -UUSE_CIN_THEORA
endif
OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer
ifeq ($(ARCH),x86_64)
OPTIMIZE = -O3 -ffast-math -fomit-frame-pointer -ffast-math -funroll-loops \
-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-fstrength-reduce
HAVE_VM_COMPILED = true
else
ifeq ($(ARCH),x86)
OPTIMIZE = -O3 -ffast-math -march=i586 -fomit-frame-pointer -ffast-math \
-funroll-loops -falign-loops=2 -falign-jumps=2 \
-falign-functions=2 -fstrength-reduce
HAVE_VM_COMPILED=true
else
USE_SSE=0
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -maltivec
HAVE_VM_COMPILED=true
endif
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -maltivec
HAVE_VM_COMPILED=true
endif
ifeq ($(ARCH),sparc)
OPTIMIZE += -mtune=ultrasparc3 -mv8plus
HAVE_VM_COMPILED=true
endif
endif
endif
ifeq ($(USE_SSE),2)
BASE_CFLAGS += -msse2 -mfpmath=sse
else
ifeq ($(USE_SSE),1)
BASE_CFLAGS += -msse -mfpmath=sse
endif
endif
ifneq ($(HAVE_VM_COMPILED),true)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
SHLIBEXT=so
SHLIBCFLAGS=-fPIC -fvisibility=hidden
SHLIBLDFLAGS=-shared $(LDFLAGS) --no-allow-shlib-undefined
BASE_CFLAGS+=-I/usr/X11R6/include
CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB)
LIBS=-ldl -lm
CLIENT_LIBS += $(SDL_LIBS) -lGL -lpthread -lX11
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += -lopenal
endif
endif
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
TTYC_LIBS += -lcurl
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_LIBS += $(OGG_LIBS)
endif
ifeq ($(USE_CIN_THEORA),1)
CLIENT_LIBS += $(THEORA_LIBS)
endif
ifeq ($(USE_CURSES),1)
LIBS += -lncurses
BASE_CFLAGS += -DUSE_CURSES
endif
ifeq ($(USE_MUMBLE),1)
CLIENT_LIBS += -lrt
endif
ifeq ($(USE_FREETYPE),1)
CLIENT_LIBS += $(shell freetype-config --libs)
endif
ifeq ($(ARCH),x86)
# linux32 make ...
BASE_CFLAGS += -m32
else
ifeq ($(ARCH),x86_64)
BASE_CFLAGS += -m64
else
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -m64
endif
endif
endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
else # ifeq Linux
#############################################################################
# SETUP AND BUILD -- MAC OS X
#############################################################################
ifeq ($(PLATFORM),darwin)
HAVE_VM_COMPILED=true
CLIENT_LIBS=
OPTIMIZE=-O3
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -faltivec
endif
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -faltivec
endif
ifeq ($(ARCH),x86)
OPTIMIZE += -march=prescott -mfpmath=sse
endif
ifeq ($(ARCH),x86_64)
OPTIMIZE += -mfpmath=sse
endif
BASE_CFLAGS += -DMACOS_X -fno-common -pipe
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -DBUILD_FREETYPE
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(FTDIR)
else
BASE_CFLAGS += $(shell freetype-config --cflags)
endif
TTYC_CFLAGS += -UBUILD_FREETYPE
endif
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += -framework OpenAL
else
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN
endif
TTYC_CFLAGS += -UUSE_OPENAL
endif
ifeq ($(USE_CURL),1)
BASE_CFLAGS += -DUSE_CURL
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
TTYC_LIBS += -lcurl
else
BASE_CFLAGS += -DUSE_CURL_DLOPEN
endif
endif
ifeq ($(USE_FREETYPE),1)
ifeq ($(USE_LOCAL_HEADERS),1)
LIBFREETYPE=$(B)/libfreetype.a
LIBFREETYPESRC=$(LIBSDIR)/macosx/libfreetype.a
else
CLIENT_LIBS += $(shell freetype-config --libs)
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(OGG_CFLAGS)
endif
TTYC_CFLAGS += -UUSE_CODEC_VORBIS
endif
ifeq ($(USE_CIN_THEORA),1)
BASE_CFLAGS += -DUSE_CIN_THEORA
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(THEORA_CFLAGS)
endif
TTYC_CFLAGS += -UUSE_CIN_THEORA
endif
ifeq ($(USE_CURSES),1)
LIBS += -lncurses
BASE_CFLAGS += -DUSE_CURSES
endif
BASE_CFLAGS += -D_THREAD_SAFE=1
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(SDLHDIR)/include
endif
# We copy sdlmain before ranlib'ing it so that subversion doesn't think
# the file has been modified by each build.
LIBSDLMAIN=$(B)/libSDLmain.a
LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
CLIENT_LIBS += -framework Cocoa -framework IOKit -framework OpenGL \
$(LIBSDIR)/macosx/libSDL-1.2.0.dylib
ifeq ($(USE_CODEC_VORBIS),1)
ifeq ($(USE_LOCAL_HEADERS),1)
LIBVORBIS=$(B)/libvorbis.a
LIBVORBISSRC=$(LIBSDIR)/macosx/libvorbis.a
LIBVORBISFILE=$(B)/libvorbisfile.a
LIBVORBISFILESRC=$(LIBSDIR)/macosx/libvorbisfile.a
LIBOGG=$(B)/libogg.a
LIBOGGSRC=$(LIBSDIR)/macosx/libogg.a
else
CLIENT_LIBS += $(OGG_LIBS)
endif
endif
ifeq ($(USE_CIN_THEORA),1)
ifeq ($(USE_LOCAL_HEADERS),1)
LIBTHEORA=$(B)/libtheoradec.a
LIBTHEORASRC=$(LIBSDIR)/macosx/libtheoradec.a
else
CLIENT_LIBS += $(THEORA_LIBS)
endif
endif
OPTIMIZE += -ffast-math -falign-loops=16
ifneq ($(HAVE_VM_COMPILED),true)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=dylib
SHLIBCFLAGS=-fPIC -fno-common
SHLIBLDFLAGS=-dynamiclib $(LDFLAGS) --no-allow-shlib-undefined
NOTSHLIBCFLAGS=-mdynamic-no-pic
TOOLS_CFLAGS += -DMACOS_X
else # ifeq darwin
#############################################################################
# SETUP AND BUILD -- MINGW32
#############################################################################
ifeq ($(PLATFORM),mingw32)
# Some MinGW installations define CC to cc, but don't actually provide cc,
# so explicitly use gcc instead (which is the only option anyway)
ifeq ($(call bin_path, $(CC)),)
CC=gcc
endif
ifndef WINDRES
WINDRES=windres
endif
ARCH=x86
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -DUSE_ICON
# In the absence of wspiapi.h, require Windows XP or later
ifeq ($(shell test -e $(CMDIR)/wspiapi.h; echo $$?),1)
BASE_CFLAGS += -DWINVER=0x501
endif
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL
BASE_CFLAGS += $(OPENAL_CFLAGS)
ifeq ($(USE_OPENAL_DLOPEN),1)
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN
else
CLIENT_LIBS += $(OPENAL_LDFLAGS)
endif
TTYC_CFLAGS += -UUSE_OPENAL
endif
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -DBUILD_FREETYPE
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(FTDIR)
else
BASE_CFLAGS += $(shell freetype-config --cflags)
endif
TTYC_CFLAGS += -UBUILD_FREETYPE
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(OGG_CFLAGS)
endif
TTYC_CFLAGS += -UUSE_CODEC_VORBIS
endif
ifeq ($(USE_CIN_THEORA),1)
BASE_CFLAGS += -DUSE_CIN_THEORA
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(THEORA_CFLAGS)
endif
TTYC_CFLAGS += -UUSE_CIN_THEORA
endif
OPTIMIZE = -O3 -march=i586 -fno-omit-frame-pointer -ffast-math \
-falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \
-fstrength-reduce
HAVE_VM_COMPILED = true
SHLIBEXT=dll
SHLIBCFLAGS=
SHLIBLDFLAGS=-shared $(LDFLAGS)--no-allow-shlib-undefined
BINEXT=.exe
LIBS = -lws2_32 -lwinmm
CLIENT_LIBS = -lgdi32 -lole32 -lopengl32
CLIENT_LDFLAGS = -mwindows
ifeq ($(USE_FREETYPE),1)
ifeq ($(USE_LOCAL_HEADERS),1)
CLIENT_LIBS += $(LIBSDIR)/win32/libfreetype.a
else
CLIENT_LIBS += $(shell freetype-config --libs)
endif
endif
ifeq ($(USE_CURL),1)
BASE_CFLAGS += -DUSE_CURL
BASE_CFLAGS += $(CURL_CFLAGS)
ifneq ($(USE_CURL_DLOPEN),1)
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -DCURL_STATICLIB
CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a
TTYC_LIBS += $(LIBSDIR)/win32/libcurl.a
else
CLIENT_LIBS += $(CURL_LIBS)
TTYC_LIBS += $(CURL_LIBS)
endif
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
ifeq ($(USE_LOCAL_HEADERS),1)
CLIENT_LIBS += \
$(LIBSDIR)/win32/libvorbisfile.a \
$(LIBSDIR)/win32/libvorbis.a \
$(LIBSDIR)/win32/libogg.a
else
CLIENT_LIBS += $(OGG_LIBS)
endif
endif
ifeq ($(USE_CIN_THEORA),1)
ifeq ($(USE_LOCAL_HEADERS),1)
CLIENT_LIBS += \
$(LIBSDIR)/win32/libtheoradec.a
else
CLIENT_LIBS += $(THEORA_LIBS)
endif
endif
ifeq ($(USE_CURSES),1)
LIBS += $(LIBSDIR)/win32/pdcurses.a
BASE_CFLAGS += -DUSE_CURSES -I$(PDCDIR)
endif
ifeq ($(ARCH),x86)
# build 32bit
BASE_CFLAGS += -m32
endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
# libmingw32 must be linked before libSDLmain
CLIENT_LIBS += -lmingw32
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(SDLHDIR)/include
CLIENT_LIBS += $(LIBSDIR)/win32/libSDLmain.a \
$(LIBSDIR)/win32/libSDL.a
else
BASE_CFLAGS += $(SDL_CFLAGS)
CLIENT_LIBS += $(SDL_LIBS)
endif
CLIENT_LIBS += -ldxguid -ldinput8
else # ifeq mingw32
#############################################################################
# SETUP AND BUILD -- FREEBSD
#############################################################################
ifeq ($(PLATFORM),freebsd)
ifneq (,$(findstring alpha,$(shell uname -m)))
ARCH=axp
else #default to x86
ARCH=x86
endif #alpha test
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON $(SDL_CFLAGS)
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL
ifeq ($(USE_OPENAL_DLOPEN),1)
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN
endif
TTYC_CFLAGS += -UUSE_OPENAL
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(OGG_CFLAGS)
endif
TTYC_CFLAGS += -UUSE_CODEC_VORBIS
endif
ifeq ($(USE_CURSES),1)
LIBS += -lncurses
BASE_CFLAGS += -DUSE_CURSES
endif
ifeq ($(ARCH),axp)
BASE_CFLAGS += -DNO_VM_COMPILED
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
else
ifeq ($(ARCH),x86)
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -mtune=pentiumpro \
-march=pentium -fomit-frame-pointer -pipe -ffast-math \
-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-funroll-loops -fstrength-reduce
HAVE_VM_COMPILED=true
else
BASE_CFLAGS += -DNO_VM_COMPILED
endif
endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS) --no-allow-shlib-undefined
# don't need -ldl (FreeBSD)
LIBS+=-lm
CLIENT_LIBS += $(SDL_LIBS) -lGL -lpthread
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += -lopenal
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_LIBS += $(OGG_LIBS)
endif
else # ifeq freebsd
#############################################################################
# SETUP AND BUILD -- OPENBSD
#############################################################################
ifeq ($(PLATFORM),openbsd)
#default to x86, no tests done on anything else
ARCH=x86
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON $(SDL_CFLAGS)
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL
ifeq ($(USE_OPENAL_DLOPEN),1)
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(OGGDIR)
else
BASE_CFLAGS += $(OGG_CFLAGS)
endif
endif
ifeq ($(USE_CURL),1)
BASE_CFLAGS += -DUSE_CURL $(CURL_CFLAGS)
USE_CURL_DLOPEN=0
endif
BASE_CFLAGS += -DNO_VM_COMPILED -pthread
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG
HAVE_VM_COMPILED=false
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
SHLIBEXT=so
SHLIBNAME=.$(SHLIBEXT)
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS) --no-allow-shlib-undefined
LIBS=-lm
CLIENT_LIBS = $(SDL_LIBS) -lGL -lpthread
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += -lossaudio -lopenal
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_LIBS += $(OGG_LIBS)
endif
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
endif
endif
else # ifeq openbsd
#############################################################################
# SETUP AND BUILD -- NETBSD
#############################################################################
ifeq ($(PLATFORM),netbsd)
LIBS=-lm
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS) --no-allow-shlib-undefined
CLIENT_LIBS=-lpthread
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
ifneq ($(ARCH),x86)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
BUILD_CLIENT = 0
BUILD_GAME_QVM = 0
else # ifeq netbsd
#############################################################################
# SETUP AND BUILD -- IRIX
#############################################################################
ifeq ($(PLATFORM),irix64)
ARCH=mips #default to MIPS
CC = c99
MKDIR = mkdir -p
BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 \
-I. $(SDL_CFLAGS) -I$(ROOT)/usr/include -DNO_VM_COMPILED
RELEASE_CFLAGS=$(BASE_CFLAGS) -O3
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
SHLIBEXT=so
SHLIBCFLAGS=
SHLIBLDFLAGS=-shared --no-allow-shlib-undefined
LIBS=-ldl -lm -lgen
# FIXME: The X libraries probably aren't necessary?
CLIENT_LIBS=-L/usr/X11/$(LIB) $(SDL_LIBS) -lGL \
-lX11 -lXext -lm
else # ifeq IRIX
#############################################################################
# SETUP AND BUILD -- SunOS
#############################################################################
ifeq ($(PLATFORM),sunos)
CC=gcc
INSTALL=ginstall
MKDIR=mkdir
ifneq (,$(findstring i86pc,$(shell uname -m)))
ARCH=x86
else #default to sparc
ARCH=sparc
endif
ifneq ($(ARCH),x86)