forked from FrozenSand/ioq3-for-UrbanTerror-4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_bak_20131213
1802 lines (1512 loc) · 45.5 KB
/
Makefile_bak_20131213
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
#
# Quake3 Unix Makefile
#
# Nov '98 by Zoid <zoid@idsoftware.com>
# My God this Code is OLD -rjc
# Loki Hacking by Bernd Kreimeier
# and a little more by Ryan C. Gordon.
# and a little more by Rafael Barrero
# and a little more by the ioq3 cr3w
# and a little more by woekele for Quake3-UrT :)
#
# GNU Make required
#
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')
ifeq ($(COMPILE_PLATFORM),darwin)
# Apple does some things a little differently...
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/)
else
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/)
endif
ifeq ($(COMPILE_PLATFORM),mingw32)
ifeq ($(COMPILE_ARCH),i386)
COMPILE_ARCH=x86
endif
endif
BUILD_CLIENT =1
BUILD_CLIENT_SMP =0
BUILD_SERVER =1
BUILD_GAME_SO =0
BUILD_GAME_QVM =0
OPTIMIZE =1
USE_SDL =1
USE_OPENAL =0
USE_CURL =1
USE_CODEC_VORBIS =0
ifneq ($(PLATFORM),mingw32)
URT_NOSSE =0
endif
ifeq ($(URT_NOSSE),1)
BUILD_SERVER =0
endif
# Barbatos - Urban Terror 4.2 auth system
# You're not forced to use it.
USE_AUTH =1
# Holblin - Urban Terror 4.2 file demo system
USE_DEMO_FORMAT_42 =1
ifeq ($(V),1)
echo_cmd=@:
Q=
else
echo_cmd=@echo
Q=@
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
ifndef ARCH
ARCH=$(COMPILE_ARCH)
endif
ifeq ($(ARCH),powerpc)
ARCH=ppc
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 COPYDIR
COPYDIR="/usr/local/games/quake3"
endif
ifndef MOUNT_DIR
MOUNT_DIR=code
endif
ifndef BUILD_DIR
BUILD_DIR=build
endif
ifndef GENERATE_DEPENDENCIES
GENERATE_DEPENDENCIES=1
endif
ifndef USE_CCACHE
USE_CCACHE=0
endif
export USE_CCACHE
ifndef USE_SDL
USE_SDL=1
endif
ifndef USE_OPENAL
USE_OPENAL=1
endif
ifndef USE_OPENAL_DLOPEN
USE_OPENAL_DLOPEN=0
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=0
endif
ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1
endif
ifeq ($(PLATFORM),darwin)
BUILD_MACOSX_UB=i386
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
UDIR=$(MOUNT_DIR)/unix
W32DIR=$(MOUNT_DIR)/win32
SYSDIR=$(MOUNT_DIR)/sys
GDIR=$(MOUNT_DIR)/game
CGDIR=$(MOUNT_DIR)/cgame
BLIBDIR=$(MOUNT_DIR)/botlib
NDIR=$(MOUNT_DIR)/null
UIDIR=$(MOUNT_DIR)/ui
Q3UIDIR=$(MOUNT_DIR)/q3_ui
JPDIR=$(MOUNT_DIR)/jpeg-6
TOOLSDIR=$(MOUNT_DIR)/tools
LOKISETUPDIR=$(UDIR)/setup
SDLHDIR=$(MOUNT_DIR)/SDL12
LIBSDIR=$(MOUNT_DIR)/libs
# extract version info
VERSION=$(shell grep "\#define Q3_VERSION" $(CMDIR)/q_shared.h | \
sed -e 's/.*".* \([^ ]*\)"/\1/')
#USE_SVN=
#ifeq ($(wildcard .svn),.svn)
# SVN_REV=$(shell LANG=C svnversion .)
# ifneq ($(SVN_REV),)
# SVN_VERSION=$(VERSION)_SVN$(SVN_REV)
# USE_SVN=1
# endif
#endif
#ifneq ($(USE_SVN),1)
# SVN_VERSION=$(VERSION)
#endif
#############################################################################
# SETUP AND BUILD -- LINUX
#############################################################################
## Defaults
LIB=lib
INSTALL=install
MKDIR=mkdir
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 -Wimplicit -Wstrict-prototypes -pipe
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1
ifeq ($(USE_OPENAL_DLOPEN),1)
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1
endif
endif
ifeq ($(USE_CURL),1)
BASE_CFLAGS += -DUSE_CURL=1
ifeq ($(USE_CURL_DLOPEN),1)
BASE_CFLAGS += -DUSE_CURL_DLOPEN=1
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif
ifeq ($(USE_SDL),1)
BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
else
BASE_CFLAGS += -I/usr/X11R6/include
endif
#Anything more then -O2 and *mmx *msse/2/ causes hitching with urbanterror\
#also -march is illrelavent unless you know your target cpu
OPTIMIZE = -O2 -mmmx -msse -msse2 -msse3
#having x86_x64 implys having full SSE support up to SSE3 so we will use it,\
#for old cpus we don't care because anything pre Pentium 4/Althlon 1600+ won't run UrbanTerror
ifeq ($(ARCH),x86_64)
OPTIMIZE = -O2 -msse -msse2 -msse3
# experimental x86_64 jit compiler! you need GNU as
HAVE_VM_COMPILED = true
else
ifeq ($(ARCH),i386)
OPTIMIZE = -O2 -mmmx
HAVE_VM_COMPILED=true
else
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -maltivec
HAVE_VM_COMPILED=false
endif
endif
endif
ifneq ($(HAVE_VM_COMPILED),true)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0 -Wall
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LDFLAGS=-lpthread
LDFLAGS=-ldl -lm
ifeq ($(USE_SDL),1)
CLIENT_LDFLAGS=$(shell sdl-config --libs)
else
CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
endif
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LDFLAGS += -lopenal
endif
endif
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LDFLAGS += -lcurl
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
endif
ifeq ($(ARCH),i386)
# linux32 make ...
BASE_CFLAGS += -m32
LDFLAGS+=-m32
endif
else # ifeq Linux
#############################################################################
# SETUP AND BUILD -- MAC OS X
#############################################################################
ifeq ($(PLATFORM),darwin)
HAVE_VM_COMPILED=true
BASE_CFLAGS=
CLIENT_LDFLAGS=
LDFLAGS=
OPTIMIZE= -O2
ifeq ($(BUILD_MACOSX_UB),ppc)
CC=gcc-3.3
BASE_CFLAGS += -arch ppc -DSMP \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc \
-F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
-isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include
# when using the 10.2 SDK we are not allowed the two-level namespace so
# in order to get the OpenAL dlopen() stuff to work without major
# modifications, the controversial -m linker flag must be used. this
# throws a ton of multiply defined errors which cannot be suppressed.
LDFLAGS += -arch ppc \
-L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
-F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk,-m
ARCH=ppc
# OS X 10.2 sdk lacks dlopen() so ded would need libSDL anyway
BUILD_SERVER=0
# because of a problem with linking on 10.2 this will generate multiply
# defined symbol errors. The errors can be turned into warnings with
# the -m linker flag, but you can't shut up the warnings
USE_OPENAL_DLOPEN=1
else
ifeq ($(BUILD_MACOSX_UB),i386)
CC=/Developer/usr/bin/gcc-4.2 # i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) - from XCode 3.2.6, hacked install on a 10.7.4 OSX
BASE_CFLAGS += -arch i386 -DSMP \
-mmacosx-version-min=10.5 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
-nostdinc \
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1/include \
-isystem /Developer/SDKs/MacOSX10.5.sdk/usr/include
LDFLAGS = -arch i386 -mmacosx-version-min=10.5 \
-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1 \
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk
ARCH=i386
BUILD_SERVER=0
else
# for whatever reason using the headers in the MacOSX SDKs tend to throw
# errors even though they are identical to the system ones which don't
# therefore we shut up warning flags when running the universal build
# script as much as possible.
BASE_CFLAGS += -Wall -Wimplicit -Wstrict-prototypes
endif
endif
#sse2 should be safe to use on mac so long as the target machine supports sse2\
#(anything capable of running urt will have sse2 support so the point is null)
ifeq ($(ARCH),ppc)
OPTIMIZE += -faltivec -O2
endif
ifeq ($(ARCH),i386)
OPTIMIZE += -O2 -msse -mfpmath=sse
# x86 vm will crash without -mstackrealign since MMX instructions will be
# used no matter what and they corrupt the frame pointer in VM calls
BASE_CFLAGS += -mstackrealign
endif
BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe
# Always include debug symbols...you can strip the binary later...
#BASE_CFLAGS += -gfull //@Barbatos removed them
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LDFLAGS += -framework OpenAL
else
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1
endif
endif
ifeq ($(USE_CURL),1)
BASE_CFLAGS += -DUSE_CURL=1
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LDFLAGS += -lcurl
else
BASE_CFLAGS += -DUSE_CURL_DLOPEN=1
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
endif
ifeq ($(USE_SDL),1)
BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 \
-I$(SDLHDIR)/include
# 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_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \
$(LIBSDIR)/macosx/libSDL-1.2.0.dylib
else
# !!! FIXME: frameworks: OpenGL, Carbon, etc...
#CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
endif
OPTIMIZE += -O2 -msse -msse2
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)
NOTSHLIBCFLAGS=-mdynamic-no-pic
else # ifeq darwin
#############################################################################
# SETUP AND BUILD -- MINGW32
#############################################################################
ifeq ($(PLATFORM),mingw32)
CC=gcc
ifndef WINDRES
WINDRES=windres
endif
ARCH=x86
#warnings are slow and ioquake 3 1.35 throws a tonn of them >>disabled unless are are compiling for debug
BASE_CFLAGS = -W
#eventully lose the static libs please they cause all manner of evil
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1
endif
ifeq ($(USE_CURL),1)
BASE_CFLAGS += -DUSE_CURL=1
ifneq ($(USE_CURL_DLOPEN),1)
BASE_CFLAGS += -DCURL_STATICLIB
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif
ifeq ($(URT_NOSSE),1)
#Optimizations for NON-SSE/SSE2 CPUs
OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math -falign-loops=2 \
-funroll-loops -falign-jumps=2 -falign-functions=2 -fstrength-reduce
else
#Optimizations for SSE/SSE2 CPUs
OPTIMIZE = -O2 -mmmx -msse -msse2
endif
HAVE_VM_COMPILED = true
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0 -Wall
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=dll
SHLIBCFLAGS=
SHLIBLDFLAGS=-shared $(LDFLAGS)
BINEXT=.exe
LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32
CLIENT_LDFLAGS=
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LDFLAGS += $(LIBSDIR)/win32/libcurl.a
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
endif
ifeq ($(ARCH),x86)
# build 32bit
BASE_CFLAGS += -m32
LDFLAGS += -m32
endif
else # ifeq mingw32
#############################################################################
# SETUP AND BUILD -- FREEBSD
#############################################################################
ifeq ($(PLATFORM),freebsd)
ifneq (,$(findstring alpha,$(shell uname -m)))
ARCH=axp
else #default to i386
ARCH=i386
endif #alpha test
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-I/usr/X11R6/include
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL=1
ifeq ($(USE_OPENAL_DLOPEN),1)
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
endif
ifeq ($(USE_SDL),1)
BASE_CFLAGS += $(shell sdl-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1
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),i386)
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -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
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LDFLAGS=-lpthread
# don't need -ldl (FreeBSD)
LDFLAGS=-lm
CLIENT_LDFLAGS =
ifeq ($(USE_SDL),1)
CLIENT_LDFLAGS += $(shell sdl-config --libs)
else
CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
endif
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lopenal
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
endif
else # ifeq freebsd
#############################################################################
# SETUP AND BUILD -- NETBSD
#############################################################################
ifeq ($(PLATFORM),netbsd)
ifeq ($(shell uname -m),i386)
ARCH=i386
endif
LDFLAGS=-lm
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LDFLAGS=-lpthread
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
ifneq ($(ARCH),i386)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
BUILD_CLIENT = 0
BUILD_GAME_QVM = 0
else # ifeq netbsd
#############################################################################
# SETUP AND BUILD -- IRIX
#############################################################################
ifeq ($(PLATFORM),irix)
ARCH=mips #default to MIPS
BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 -mips3 \
-nostdinc -I. -I$(ROOT)/usr/include -DNO_VM_COMPILED
RELEASE_CFLAGS=$(BASE_CFLAGS) -O3
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
SHLIBEXT=so
SHLIBCFLAGS=
SHLIBLDFLAGS=-shared
LDFLAGS=-ldl -lm
CLIENT_LDFLAGS=-L/usr/X11/$(LIB) -lGL -lX11 -lXext -lm
else # ifeq IRIX
#############################################################################
# SETUP AND BUILD -- SunOS
#############################################################################
ifeq ($(PLATFORM),sunos)
CC=gcc
INSTALL=ginstall
MKDIR=gmkdir
COPYDIR="/usr/local/share/games/quake3"
ifneq (,$(findstring i86pc,$(shell uname -m)))
ARCH=i386
else #default to sparc
ARCH=sparc
endif
ifneq ($(ARCH),i386)
ifneq ($(ARCH),sparc)
$(error arch $(ARCH) is currently not supported)
endif
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes -pipe
ifeq ($(USE_SDL),1)
BASE_CFLAGS += -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
else
BASE_CFLAGS += -I/usr/openwin/include
endif
OPTIMIZE = -O3 -ffast-math -funroll-loops
ifeq ($(ARCH),sparc)
OPTIMIZE = -O3 -ffast-math -falign-loops=2 \
-falign-jumps=2 -falign-functions=2 -fstrength-reduce \
-mtune=ultrasparc -mv8plus -mno-faster-structs \
-funroll-loops
else
ifeq ($(ARCH),i386)
OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math \
-funroll-loops -falign-loops=2 -falign-jumps=2 \
-falign-functions=2 -fstrength-reduce
HAVE_VM_COMPILED=true
BASE_CFLAGS += -m32
LDFLAGS += -m32
BASE_CFLAGS += -I/usr/X11/include/NVIDIA
endif
endif
ifneq ($(HAVE_VM_COMPILED),true)
BASE_CFLAGS += -DNO_VM_COMPILED
endif
DEBUG_CFLAGS = $(BASE_CFLAGS) -ggdb -O0
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LDFLAGS=-lpthread
LDFLAGS=-lsocket -lnsl -ldl -lm
BOTCFLAGS=-O0
ifeq ($(USE_SDL),1)
CLIENT_LDFLAGS=$(shell sdl-config --libs) -L/usr/X11/lib -lGLU -lX11 -lXext
else
CLIENT_LDFLAGS=-L/usr/openwin/$(LIB) -L/usr/X11/lib -lGLU -lX11 -lXext
endif
else # ifeq sunos
#############################################################################
# SETUP AND BUILD -- GENERIC
#############################################################################
BASE_CFLAGS=-DNO_VM_COMPILED
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared
endif #Linux
endif #darwin
endif #mingw32
endif #FreeBSD
endif #NetBSD
endif #IRIX
endif #SunOS
TARGETS =
ifneq ($(BUILD_SERVER),0)
TARGETS += $(B)/Quake3-UrT-Ded.$(ARCH)$(BINEXT)
endif
ifneq ($(BUILD_CLIENT),0)
ifeq ($(URT_NOSSE),1)
TARGETS += $(B)/Quake3-UrT-no-SSE2.$(ARCH)$(BINEXT)
else
TARGETS += $(B)/Quake3-UrT.$(ARCH)$(BINEXT)
endif
ifneq ($(BUILD_CLIENT_SMP),0)
TARGETS += $(B)/Quake3-UrT-smp.$(ARCH)$(BINEXT)
endif
endif
ifneq ($(BUILD_GAME_SO),0)
TARGETS += \
$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
$(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \
$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
$(B)/missionpack/ui$(ARCH).$(SHLIBEXT)
endif
ifneq ($(BUILD_GAME_QVM),0)
ifneq ($(CROSS_COMPILING),1)
TARGETS += \
$(B)/baseq3/vm/cgame.qvm \
$(B)/baseq3/vm/qagame.qvm \
$(B)/baseq3/vm/ui.qvm \
$(B)/missionpack/vm/qagame.qvm \
$(B)/missionpack/vm/cgame.qvm \
$(B)/missionpack/vm/ui.qvm
endif
endif
ifeq ($(USE_CCACHE),1)
CC := ccache $(CC)
endif
#Barbatos
ifeq ($(USE_AUTH),1)
BASE_CFLAGS += -DUSE_AUTH=1
endif
#Barbatos
ifeq ($(USE_DEMO_FORMAT_42),1)
BASE_CFLAGS += -DUSE_DEMO_FORMAT_42=1
endif
ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
endif
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -DUSE_LOCAL_HEADERS=1
endif
ifeq ($(GENERATE_DEPENDENCIES),1)
BASE_CFLAGS += -MMD
endif
ifeq ($(USE_SVN),1)
BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\"
endif
define DO_CC
$(echo_cmd) "CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
endef
define DO_SMP_CC
$(echo_cmd) "SMP_CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DSMP -o $@ -c $<
endef
define DO_BOT_CC
$(echo_cmd) "BOT_CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) -DBOTLIB -o $@ -c $<
endef
ifeq ($(GENERATE_DEPENDENCIES),1)
DO_QVM_DEP=cat $(@:%.o=%.d) | sed -e 's/\.o/\.asm/g' >> $(@:%.o=%.d)
endif
define DO_SHLIB_CC
$(echo_cmd) "SHLIB_CC $<"
$(Q)$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
$(Q)$(DO_QVM_DEP)
endef
define DO_SHLIB_CC_MISSIONPACK
$(echo_cmd) "SHLIB_CC_MISSIONPACK $<"
$(Q)$(CC) -DMISSIONPACK $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
$(Q)$(DO_QVM_DEP)
endef
define DO_AS
$(echo_cmd) "AS $<"
$(Q)$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
endef
define DO_DED_CC
$(echo_cmd) "DED_CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) -o $@ -c $<
endef
define DO_WINDRES
$(echo_cmd) "WINDRES $<"
$(Q)$(WINDRES) -i $< -o $@
endef
#############################################################################
# MAIN TARGETS
#############################################################################
default: release
all: debug release
debug:
@$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)" V=$(V)
release:
@$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)" V=$(V)
ifeq ($(PLATFORM),darwin)
@echo "Updating OSX bundle"
./osx_update_bundle.py "$(BR)" $(TARGETS)
endif
# Create the build directories and tools, print out
# an informational message, then start building
targets: makedirs tools
@echo ""
@echo "Building Quake3-UrT in $(B):"
@echo " PLATFORM: $(PLATFORM)"
@echo " ARCH: $(ARCH)"
@echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)"
@echo " COMPILE_ARCH: $(COMPILE_ARCH)"
@echo " CC: $(CC)"
@echo ""
@echo " CFLAGS:"
@for i in $(CFLAGS); \
do \
echo " $$i"; \
done
@echo ""
@echo " Output:"
@for i in $(TARGETS); \
do \
echo " $$i"; \
done
ifneq ($(strip $(TARGETS)),) # this avoids a nasty recursion if the target list is empty
@echo ""
@$(MAKE) $(TARGETS) V=$(V)
else
@echo "no targets!"
endif
makedirs:
@if [ ! -d $(BUILD_DIR) ];then $(MKDIR) $(BUILD_DIR);fi
@if [ ! -d $(B) ];then $(MKDIR) $(B);fi
@if [ ! -d $(B)/client ];then $(MKDIR) $(B)/client;fi
@if [ ! -d $(B)/clientsmp ];then $(MKDIR) $(B)/clientsmp;fi
@if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi
@if [ ! -d $(B)/baseq3 ];then $(MKDIR) $(B)/baseq3;fi
@if [ ! -d $(B)/baseq3/cgame ];then $(MKDIR) $(B)/baseq3/cgame;fi
@if [ ! -d $(B)/baseq3/game ];then $(MKDIR) $(B)/baseq3/game;fi
@if [ ! -d $(B)/baseq3/ui ];then $(MKDIR) $(B)/baseq3/ui;fi
@if [ ! -d $(B)/baseq3/qcommon ];then $(MKDIR) $(B)/baseq3/qcommon;fi
@if [ ! -d $(B)/baseq3/vm ];then $(MKDIR) $(B)/baseq3/vm;fi
@if [ ! -d $(B)/missionpack ];then $(MKDIR) $(B)/missionpack;fi
@if [ ! -d $(B)/missionpack/cgame ];then $(MKDIR) $(B)/missionpack/cgame;fi
@if [ ! -d $(B)/missionpack/game ];then $(MKDIR) $(B)/missionpack/game;fi
@if [ ! -d $(B)/missionpack/ui ];then $(MKDIR) $(B)/missionpack/ui;fi
@if [ ! -d $(B)/missionpack/qcommon ];then $(MKDIR) $(B)/missionpack/qcommon;fi
@if [ ! -d $(B)/missionpack/vm ];then $(MKDIR) $(B)/missionpack/vm;fi
#############################################################################
# QVM BUILD TOOLS
#############################################################################
#
#Q3LCC=$(TOOLSDIR)/q3lcc$(BINEXT)
#Q3ASM=$(TOOLSDIR)/q3asm$(BINEXT)
#
#ifeq ($(CROSS_COMPILING),1)
#tools:
# @echo QVM tools not built when cross-compiling
#else
#tools:
# $(MAKE) -C $(TOOLSDIR)/lcc install
# $(MAKE) -C $(TOOLSDIR)/asm install
#endif
#
#define DO_Q3LCC
#$(echo_cmd) "Q3LCC $<"
#$(Q)$(Q3LCC) -o $@ $<
#endef
#
#define DO_Q3LCC_MISSIONPACK
#$(echo_cmd) "Q3LCC_MISSIONPACK $<"
#$(Q)$(Q3LCC) -DMISSIONPACK -o $@ $<
#endef
#
#
#############################################################################
# CLIENT/SERVER
#############################################################################
Q3OBJ = \
$(B)/client/cl_cgame.o \
$(B)/client/cl_cin.o \
$(B)/client/cl_console.o \
$(B)/client/cl_input.o \
$(B)/client/cl_keys.o \
$(B)/client/cl_main.o \
$(B)/client/cl_net_chan.o \
$(B)/client/cl_parse.o \
$(B)/client/cl_scrn.o \
$(B)/client/cl_ui.o \
$(B)/client/cl_avi.o \
\
$(B)/client/cm_load.o \
$(B)/client/cm_patch.o \
$(B)/client/cm_polylib.o \
$(B)/client/cm_test.o \
$(B)/client/cm_trace.o \
\
$(B)/client/cmd.o \
$(B)/client/common.o \
$(B)/client/cvar.o \
$(B)/client/files.o \
$(B)/client/md4.o \
$(B)/client/md5.o \
$(B)/client/msg.o \
$(B)/client/net_chan.o \
$(B)/client/net_ip.o \
$(B)/client/huffman.o \
\
$(B)/client/snd_adpcm.o \
$(B)/client/snd_dma.o \
$(B)/client/snd_dmahd.o \
$(B)/client/snd_mem.o \
$(B)/client/snd_mix.o \
$(B)/client/snd_wavelet.o \
\
$(B)/client/snd_main.o \
$(B)/client/snd_codec.o \
$(B)/client/snd_codec_wav.o \
$(B)/client/snd_codec_ogg.o \
\
$(B)/client/qal.o \
$(B)/client/snd_openal.o \
\
$(B)/client/cl_curl.o \
\
$(B)/client/sv_bot.o \