-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
1297 lines (1105 loc) · 30.8 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
#
# rtcw-sp Makefile
#
# GNU Make required
#
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/)
ifeq ($(COMPILE_PLATFORM),darwin)
# Apple does some things a little differently...
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/)
endif
ifeq ($(COMPILE_PLATFORM),mingw32)
ifeq ($(COMPILE_ARCH),i386)
COMPILE_ARCH=x86
endif
endif
ifndef BUILD_STANDALONE
BUILD_STANDALONE =
endif
ifndef BUILD_CLIENT
BUILD_CLIENT =
endif
ifndef BUILD_SERVER
BUILD_SERVER =
endif
ifndef BUILD_GAME_SO
BUILD_GAME_SO =
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 COPYDIR
COPYDIR="/usr/local/games/wolfenstein"
endif
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_INTERNAL_ZLIB
USE_INTERNAL_ZLIB=1
endif
ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1
endif
ifeq ($(COMPILE_PLATFORM),mingw32)
ifndef DEBUG_CFLAGS
DEBUG_CFLAGS=-g -O0 -ggdb -gstabs
endif
else
ifndef DEBUG_CFLAGS
DEBUG_CFLAGS=-g -O0 -ggdb
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
SYSDIR=$(MOUNT_DIR)/sys
GDIR=$(MOUNT_DIR)/game
CGDIR=$(MOUNT_DIR)/cgame
BLIBDIR=$(MOUNT_DIR)/botlib
BAIDIR=$(MOUNT_DIR)/botai
NDIR=$(MOUNT_DIR)/null
UIDIR=$(MOUNT_DIR)/ui
JPDIR=$(MOUNT_DIR)/jpeg-6
ZDIR=$(MOUNT_DIR)/zlib
SPLDIR=$(MOUNT_DIR)/splines
LOKISETUPDIR=misc/setup
SDLHDIR=$(MOUNT_DIR)/SDL12
LIBSDIR=$(MOUNT_DIR)/libs
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)
SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl|sed 's/-Dmain=SDL_main//')
SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl)
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
endif
# version info
VERSION=1.41
USE_SVN=
ifeq ($(wildcard .svn),.svn)
SVN_REV=$(shell LANG=C svnversion .)
ifneq ($(SVN_REV),)
VERSION:=$(VERSION)_SVN$(SVN_REV)
USE_SVN=1
endif
else
ifeq ($(wildcard .git/svn/.metadata),.git/svn/.metadata)
SVN_REV=$(shell LANG=C git svn info | awk '$$1 == "Revision:" {print $$2; exit 0}')
ifneq ($(SVN_REV),)
VERSION:=$(VERSION)_SVN$(SVN_REV)
endif
endif
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 -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wno-write-strings \
-pipe -DUSE_ICON -DC_ONLY -fno-common
CLIENT_CFLAGS = $(SDL_CFLAGS)
SERVER_CFLAGS =
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
ifeq ($(ARCH),x86_64)
OPTIMIZEVM = -O3 -Wall -Wno-unused-but-set-variable -Wno-unused -Wno-address
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
else
ifeq ($(ARCH),i386)
OPTIMIZEVM = -O3 -m32 -march=pentium3 -fomit-frame-pointer \
-funroll-loops -falign-loops=2 -falign-jumps=2 \
-falign-functions=2 -fstrength-reduce
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
else
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -maltivec
endif
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -maltivec
endif
ifeq ($(ARCH),sparc)
OPTIMIZE += -mtune=ultrasparc3 -mv8plus
OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus
endif
endif
endif
BASE_CFLAGS += -DNO_VM_COMPILED
SHLIBEXT=so
SHLIBCFLAGS=-fPIC -fvisibility=hidden -fno-common
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LIBS=-lpthread
LIBS= $(LIB_PATH) -ldl -lm -lsupc++
ifeq ($(ARCH),i386)
CLIENT_LIBS=-L/usr/lib32 -lSDL-1.2 -lGL
else
CLIENT_LIBS=-lSDL -lGL
endif
ifeq ($(USE_LOCAL_HEADERS),1)
CLIENT_CFLAGS += -I$(SDLHDIR)/include
endif
ifeq ($(ARCH),i386)
# linux32 make ...
BASE_CFLAGS += -m32
else
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -m64
endif
endif
else # ifeq Linux
#############################################################################
# SETUP AND BUILD -- MAC OS X
#############################################################################
ifeq ($(PLATFORM),darwin)
LIBS = -framework Cocoa -lsupc++
CLIENT_LIBS=
OPTIMIZEVM=
#BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes
BASE_CFLAGS = -Wall -Wimplicit -DC_ONLY -m32
CLIENT_CFLAGS =
SERVER_CFLAGS =
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -faltivec
OPTIMIZEVM += -O3
endif
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -faltivec
endif
ifeq ($(ARCH),i386)
OPTIMIZEVM += -march=prescott -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
# fretn
BASE_CFLAGS += -mstackrealign
endif
# BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -D__MACOS__ -fno-common -pipe
BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe
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 IOKit -framework OpenGL \
$(LIBSDIR)/macosx/libSDL-1.2.0.dylib
OPTIMIZEVM += -falign-loops=16
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
BASE_CFLAGS += -DNO_VM_COMPILED
SHLIBEXT=dylib
SHLIBCFLAGS=-fPIC -fno-common
SHLIBLDFLAGS=-dynamiclib $(LDFLAGS)
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
#BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
BASE_CFLAGS = -fno-strict-aliasing -Wimplicit \
-DUSE_ICON -DC_ONLY
CLIENT_CFLAGS =
SERVER_CFLAGS =
# 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 ($(ARCH),x64)
OPTIMIZEVM = -O3 -fno-omit-frame-pointer \
-falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \
-fstrength-reduce
OPTIMIZE = $(OPTIMIZEVM) --fast-math
HAVE_VM_COMPILED = true
endif
ifeq ($(ARCH),x86)
OPTIMIZEVM = -O3 -march=i586 -fno-omit-frame-pointer \
-falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \
-fstrength-reduce
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED = true
endif
SHLIBEXT=dll
SHLIBCFLAGS=
SHLIBLDFLAGS=-shared $(LDFLAGS)
BINEXT=.exe
LIBS= -lws2_32 -lwinmm -lpsapi
CLIENT_LDFLAGS = -mwindows
CLIENT_LIBS = -lgdi32 -lole32 -lopengl32 -lstdc++
ifeq ($(ARCH),x86)
# build 32bit
BASE_CFLAGS += -m32
else
BASE_CFLAGS += -m64
endif
# libmingw32 must be linked before libSDLmain
CLIENT_LIBS += -lmingw32
ifeq ($(USE_LOCAL_HEADERS),1)
CLIENT_CFLAGS += -I$(SDLHDIR)/include
ifeq ($(ARCH), x86)
CLIENT_LIBS += $(LIBSDIR)/win32/libSDLmain.a \
$(LIBSDIR)/win32/libSDL.dll.a
else
CLIENT_LIBS += $(LIBSDIR)/win64/libSDLmain.a \
$(LIBSDIR)/win64/libSDL.dll.a \
$(LIBSDIR)/win64/libSDL.a
endif
else
CLIENT_CFLAGS += $(SDL_CFLAGS)
CLIENT_LIBS += $(SDL_LIBS)
endif
else # ifeq mingw32
#############################################################################
# SETUP AND BUILD -- GENERIC
#############################################################################
BASE_CFLAGS=-DNO_VM_COMPILED
OPTIMIZE = -O3
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared
endif #Linux
endif #darwin
endif #mingw32
TARGETS =
ifndef FULLBINEXT
FULLBINEXT=.$(ARCH)$(BINEXT)
endif
ifndef SHLIBNAME
SHLIBNAME=$(ARCH).$(SHLIBEXT)
endif
ifneq ($(BUILD_SERVER),0)
TARGETS += $(B)/wolfspded$(FULLBINEXT)
endif
ifneq ($(BUILD_CLIENT),0)
TARGETS += $(B)/wolfsp$(FULLBINEXT)
endif
ifneq ($(BUILD_GAME_SO),0)
TARGETS += \
$(B)/main/cgame$(SHLIBNAME) \
$(B)/main/ui$(SHLIBNAME) \
$(B)/main/qagame$(SHLIBNAME)
endif
ifeq ($(USE_INTERNAL_ZLIB),1)
BASE_CFLAGS += -DNO_GZIP
BASE_CFLAGS += -I$(ZDIR)
else
LIBS += -lz
endif
ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
endif
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -DUSE_LOCAL_HEADERS
endif
ifeq ($(BUILD_STANDALONE),1)
BASE_CFLAGS += -DSTANDALONE
endif
ifeq ($(GENERATE_DEPENDENCIES),1)
DEPEND_CFLAGS = -MMD
else
DEPEND_CFLAGS =
endif
ifeq ($(NO_STRIP),1)
STRIP_FLAG =
else
STRIP_FLAG = -s
endif
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
ifeq ($(V),1)
echo_cmd=@:
Q=
else
echo_cmd=@echo
Q=@
endif
define DO_CC
$(echo_cmd) "CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $<
endef
define DO_BOT_CC
$(echo_cmd) "BOT_CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) $(OPTIMIZE) -DBOTLIB -o $@ -c $<
endef
define DO_SHLIB_CC
$(echo_cmd) "SHLIB_CC $<"
$(Q)$(CC) $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $<
endef
define DO_GAME_CC
$(echo_cmd) "GAME_CC $<"
$(Q)$(CC) -DQAGAME -DGAMEDLL $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $<
endef
define DO_CGAME_CC
$(echo_cmd) "CGAME_CC $<"
$(Q)$(CC) -DCGAME -DCGAMEDLL $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $<
endef
define DO_UI_CC
$(echo_cmd) "UI_CC $<"
$(Q)$(CC) -DUI $(SHLIBCFLAGS) $(CFLAGS) $(OPTIMIZEVM) -o $@ -c $<
endef
define DO_AS
$(echo_cmd) "AS $<"
$(Q)$(CC) $(CFLAGS) $(OPTIMIZE) -x assembler-with-cpp -o $@ -c $<
endef
define DO_DED_CC
$(echo_cmd) "DED_CC $<"
$(Q)$(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) $(SERVER_CFLAGS) $(OPTIMIZE) -o $@ -c $<
endef
define DO_WINDRES
$(echo_cmd) "WINDRES $<"
$(Q)$(WINDRES) -i $< -o $@
endef
define DO_SPLINE_CXX
$(echo_cmd) "SPLINE_CXX $<"
$(Q)$(CXX) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $<
endef
#############################################################################
# MAIN TARGETS
#############################################################################
default: release
all: debug release
debug:
@$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \
OPTIMIZE="$(DEBUG_CFLAGS)" OPTIMIZEVM="$(DEBUG_CFLAGS)" \
CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V)
release:
@$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(BASE_CFLAGS) $(DEPEND_CFLAGS)" \
OPTIMIZE="-DNDEBUG $(OPTIMIZE)" OPTIMIZEVM="-DNDEBUG $(OPTIMIZEVM)" \
CLIENT_CFLAGS="$(CLIENT_CFLAGS)" SERVER_CFLAGS="$(SERVER_CFLAGS)" V=$(V)
# Create the build directories, check libraries and print out
# an informational message, then start building
targets: makedirs
@echo ""
@echo "Building wolfsp in $(B):"
@echo " PLATFORM: $(PLATFORM)"
@echo " ARCH: $(ARCH)"
@echo " VERSION: $(VERSION)"
@echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)"
@echo " COMPILE_ARCH: $(COMPILE_ARCH)"
@echo " CC: $(CC)"
@echo ""
@echo " CFLAGS:"
-@for i in $(CFLAGS); \
do \
echo " $$i"; \
done
-@for i in $(OPTIMIZE); \
do \
echo " $$i"; \
done
@echo ""
@echo " CLIENT_CFLAGS:"
-@for i in $(CLIENT_CFLAGS); \
do \
echo " $$i"; \
done
@echo ""
@echo " SERVER_CFLAGS:"
-@for i in $(SERVER_CFLAGS); \
do \
echo " $$i"; \
done
@echo ""
@echo " LDFLAGS:"
-@for i in $(LDFLAGS); \
do \
echo " $$i"; \
done
@echo ""
@echo " LIBS:"
-@for i in $(LIBS); \
do \
echo " $$i"; \
done
@echo ""
@echo " CLIENT_LIBS:"
-@for i in $(CLIENT_LIBS); \
do \
echo " $$i"; \
done
@echo ""
@echo " Output:"
-@for i in $(TARGETS); \
do \
echo " $$i"; \
done
@echo ""
ifneq ($(TARGETS),)
@$(MAKE) $(TARGETS) V=$(V)
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)/splines ];then $(MKDIR) $(B)/splines;fi
@if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi
@if [ ! -d $(B)/main ];then $(MKDIR) $(B)/main;fi
@if [ ! -d $(B)/main/cgame ];then $(MKDIR) $(B)/main/cgame;fi
@if [ ! -d $(B)/main/game ];then $(MKDIR) $(B)/main/game;fi
@if [ ! -d $(B)/main/ui ];then $(MKDIR) $(B)/main/ui;fi
@if [ ! -d $(B)/main/qcommon ];then $(MKDIR) $(B)/main/qcommon;fi
@if [ ! -d $(B)/main/vm ];then $(MKDIR) $(B)/main/vm;fi
#############################################################################
# CLIENT/SERVER
#############################################################################
WOLFOBJ = \
$(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/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/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_mem.o \
$(B)/client/snd_mix.o \
$(B)/client/snd_wavelet.o \
\
$(B)/client/sv_bot.o \
$(B)/client/sv_ccmds.o \
$(B)/client/sv_client.o \
$(B)/client/sv_game.o \
$(B)/client/sv_init.o \
$(B)/client/sv_main.o \
$(B)/client/sv_net_chan.o \
$(B)/client/sv_snapshot.o \
$(B)/client/sv_world.o \
\
$(B)/client/q_math.o \
$(B)/client/q_shared.o \
\
$(B)/client/unzip.o \
$(B)/client/vm.o \
\
$(B)/client/be_aas_bspq3.o \
$(B)/client/be_aas_cluster.o \
$(B)/client/be_aas_debug.o \
$(B)/client/be_aas_entity.o \
$(B)/client/be_aas_file.o \
$(B)/client/be_aas_main.o \
$(B)/client/be_aas_move.o \
$(B)/client/be_aas_optimize.o \
$(B)/client/be_aas_reach.o \
$(B)/client/be_aas_route.o \
$(B)/client/be_aas_routealt.o \
$(B)/client/be_aas_routetable.o \
$(B)/client/be_aas_sample.o \
$(B)/client/be_ai_char.o \
$(B)/client/be_ai_chat.o \
$(B)/client/be_ai_gen.o \
$(B)/client/be_ai_goal.o \
$(B)/client/be_ai_move.o \
$(B)/client/be_ai_weap.o \
$(B)/client/be_ai_weight.o \
$(B)/client/be_ea.o \
$(B)/client/be_interface.o \
$(B)/client/l_crc.o \
$(B)/client/l_libvar.o \
$(B)/client/l_log.o \
$(B)/client/l_memory.o \
$(B)/client/l_precomp.o \
$(B)/client/l_script.o \
$(B)/client/l_struct.o \
\
$(B)/client/jcapimin.o \
$(B)/client/jccoefct.o \
$(B)/client/jccolor.o \
$(B)/client/jcdctmgr.o \
$(B)/client/jchuff.o \
$(B)/client/jcinit.o \
$(B)/client/jcmainct.o \
$(B)/client/jcmarker.o \
$(B)/client/jcmaster.o \
$(B)/client/jcomapi.o \
$(B)/client/jcparam.o \
$(B)/client/jcphuff.o \
$(B)/client/jcprepct.o \
$(B)/client/jcsample.o \
$(B)/client/jdapimin.o \
$(B)/client/jdapistd.o \
$(B)/client/jdatasrc.o \
$(B)/client/jdcoefct.o \
$(B)/client/jdcolor.o \
$(B)/client/jddctmgr.o \
$(B)/client/jdhuff.o \
$(B)/client/jdinput.o \
$(B)/client/jdmainct.o \
$(B)/client/jdmarker.o \
$(B)/client/jdmaster.o \
$(B)/client/jdpostct.o \
$(B)/client/jdsample.o \
$(B)/client/jdtrans.o \
$(B)/client/jerror.o \
$(B)/client/jfdctflt.o \
$(B)/client/jidctflt.o \
$(B)/client/jmemmgr.o \
$(B)/client/jmemnobs.o \
$(B)/client/jutils.o \
\
$(B)/client/tr_animation.o \
$(B)/client/tr_backend.o \
$(B)/client/tr_bsp.o \
$(B)/client/tr_cmds.o \
$(B)/client/tr_cmesh.o \
$(B)/client/tr_curve.o \
$(B)/client/tr_flares.o \
$(B)/client/tr_font.o \
$(B)/client/tr_image.o \
$(B)/client/tr_init.o \
$(B)/client/tr_light.o \
$(B)/client/tr_main.o \
$(B)/client/tr_marks.o \
$(B)/client/tr_mesh.o \
$(B)/client/tr_model.o \
$(B)/client/tr_noise.o \
$(B)/client/tr_scene.o \
$(B)/client/tr_shade.o \
$(B)/client/tr_shade_calc.o \
$(B)/client/tr_shader.o \
$(B)/client/tr_shadows.o \
$(B)/client/tr_sky.o \
$(B)/client/tr_surface.o \
$(B)/client/tr_world.o \
\
$(B)/splines/math_angles.o \
$(B)/splines/math_matrix.o \
$(B)/splines/math_quaternion.o \
$(B)/splines/math_vector.o \
$(B)/splines/q_parse.o \
$(B)/splines/splines.o \
$(B)/splines/util_str.o \
\
$(B)/client/sdl_gamma.o \
$(B)/client/sdl_input.o \
$(B)/client/sdl_snd.o \
\
$(B)/client/con_passive.o \
$(B)/client/con_log.o \
$(B)/client/sys_main.o
ifeq ($(USE_INTERNAL_ZLIB),1)
WOLFOBJ += \
$(B)/client/adler32.o \
$(B)/client/crc32.o \
$(B)/client/inffast.o \
$(B)/client/inflate.o \
$(B)/client/inftrees.o \
$(B)/client/zutil.o
endif
define DO_SPLINE_CXX
$(echo_cmd) "SPLINE_CXX $<"
$(Q)$(CXX) $(NOTSHLIBCFLAGS) $(CFLAGS) $(CLIENT_CFLAGS) $(OPTIMIZE) -o $@ -c $<
endef
ifeq ($(PLATFORM),mingw32)
WOLFOBJ += \
$(B)/client/win_resource.o \
$(B)/client/sys_win32.o
else
WOLFOBJ += \
$(B)/client/sys_unix.o
endif
ifeq ($(PLATFORM),darwin)
WOLFOBJ += \
$(B)/client/sys_osx.o
endif
WOLFPOBJ += \
$(B)/client/sdl_glimp.o
$(B)/wolfsp$(FULLBINEXT): $(WOLFOBJ) $(WOLFPOBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
-o $@ $(WOLFOBJ) $(WOLFPOBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
ifneq ($(strip $(LIBSDLMAIN)),)
ifneq ($(strip $(LIBSDLMAINSRC)),)
$(LIBSDLMAIN) : $(LIBSDLMAINSRC)
cp $< $@
ranlib $@
endif
endif
#############################################################################
# DEDICATED SERVER
#############################################################################
WOLFDOBJ = \
$(B)/ded/sv_bot.o \
$(B)/ded/sv_client.o \
$(B)/ded/sv_ccmds.o \
$(B)/ded/sv_game.o \
$(B)/ded/sv_init.o \
$(B)/ded/sv_main.o \
$(B)/ded/sv_net_chan.o \
$(B)/ded/sv_snapshot.o \
$(B)/ded/sv_world.o \
\
$(B)/ded/cm_load.o \
$(B)/ded/cm_patch.o \
$(B)/ded/cm_polylib.o \
$(B)/ded/cm_test.o \
$(B)/ded/cm_trace.o \
$(B)/ded/cmd.o \
$(B)/ded/common.o \
$(B)/ded/cvar.o \
$(B)/ded/files.o \
$(B)/ded/md4.o \
$(B)/ded/msg.o \
$(B)/ded/net_chan.o \
$(B)/ded/net_ip.o \
$(B)/ded/huffman.o \
\
$(B)/ded/q_math.o \
$(B)/ded/q_shared.o \
\
$(B)/ded/unzip.o \
$(B)/ded/vm.o \
\
$(B)/ded/be_aas_bspq3.o \
$(B)/ded/be_aas_cluster.o \
$(B)/ded/be_aas_debug.o \
$(B)/ded/be_aas_entity.o \
$(B)/ded/be_aas_file.o \
$(B)/ded/be_aas_main.o \
$(B)/ded/be_aas_move.o \
$(B)/ded/be_aas_optimize.o \
$(B)/ded/be_aas_reach.o \
$(B)/ded/be_aas_route.o \
$(B)/ded/be_aas_routealt.o \
$(B)/ded/be_aas_routetable.o \
$(B)/ded/be_aas_sample.o \
$(B)/ded/be_ai_char.o \
$(B)/ded/be_ai_chat.o \
$(B)/ded/be_ai_gen.o \
$(B)/ded/be_ai_goal.o \
$(B)/ded/be_ai_move.o \
$(B)/ded/be_ai_weap.o \
$(B)/ded/be_ai_weight.o \
$(B)/ded/be_ea.o \
$(B)/ded/be_interface.o \
$(B)/ded/l_crc.o \
$(B)/ded/l_libvar.o \
$(B)/ded/l_log.o \
$(B)/ded/l_memory.o \
$(B)/ded/l_precomp.o \
$(B)/ded/l_script.o \
$(B)/ded/l_struct.o \
\
$(B)/ded/null_client.o \
$(B)/ded/null_input.o \
$(B)/ded/null_snddma.o \
\
$(B)/ded/con_log.o \
$(B)/ded/sys_main.o
ifeq ($(USE_INTERNAL_ZLIB),1)
WOLFDOBJ += \
$(B)/ded/adler32.o \
$(B)/ded/crc32.o \
$(B)/ded/inffast.o \
$(B)/ded/inflate.o \
$(B)/ded/inftrees.o \
$(B)/ded/zutil.o
endif
ifeq ($(PLATFORM),mingw32)
WOLFDOBJ += \
$(B)/ded/con_win32.o \
$(B)/ded/win_resource.o \
$(B)/ded/sys_win32.o
else
WOLFDOBJ += \
$(B)/ded/sys_unix.o \
$(B)/ded/con_tty.o
endif
ifeq ($(PLATFORM),darwin)
WOLFDOBJ += \
$(B)/ded/sys_osx.o
endif
$(B)/wolfspded$(FULLBINEXT): $(WOLFDOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(WOLFDOBJ) $(LIBS)
#############################################################################
## main CGAME
#############################################################################
WOLFCGOBJ_ = \
$(B)/main/cgame/cg_main.o \
$(B)/main/cgame/bg_animation.o \
$(B)/main/cgame/bg_misc.o \
$(B)/main/cgame/bg_pmove.o \
$(B)/main/cgame/bg_slidemove.o \
$(B)/main/cgame/cg_consolecmds.o \
$(B)/main/cgame/cg_draw.o \
$(B)/main/cgame/cg_drawtools.o \
$(B)/main/cgame/cg_effects.o \
$(B)/main/cgame/cg_ents.o \
$(B)/main/cgame/cg_event.o \
$(B)/main/cgame/cg_flamethrower.o \
$(B)/main/cgame/cg_info.o \
$(B)/main/cgame/cg_localents.o \
$(B)/main/cgame/cg_marks.o \
$(B)/main/cgame/cg_newDraw.o \
$(B)/main/cgame/cg_particles.o \
$(B)/main/cgame/cg_players.o \
$(B)/main/cgame/cg_playerstate.o \
$(B)/main/cgame/cg_predict.o \
$(B)/main/cgame/cg_scoreboard.o \
$(B)/main/cgame/cg_servercmds.o \
$(B)/main/cgame/cg_sound.o \
$(B)/main/cgame/cg_snapshot.o \
$(B)/main/cgame/cg_trails.o \
$(B)/main/cgame/cg_view.o \
$(B)/main/cgame/cg_weapons.o \
\
$(B)/main/ui/ui_shared.o \
\
$(B)/main/qcommon/q_math.o \
$(B)/main/qcommon/q_shared.o
WOLFCGOBJ = $(WOLFCGOBJ_) $(B)/main/cgame/cg_syscalls.o
WOLFCGVMOBJ = $(WOLFCGOBJ_:%.o=%.asm)
$(B)/main/cgame$(SHLIBNAME): $(WOLFCGOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(WOLFCGOBJ)
#############################################################################
## main GAME
#############################################################################
WOLFGOBJ_ = \
$(B)/main/game/g_main.o \
$(B)/main/game/ai_cast.o \
$(B)/main/game/ai_cast_characters.o \
$(B)/main/game/ai_cast_debug.o \
$(B)/main/game/ai_cast_events.o \
$(B)/main/game/ai_cast_fight.o \
$(B)/main/game/ai_cast_func_attack.o \
$(B)/main/game/ai_cast_func_boss1.o \
$(B)/main/game/ai_cast_funcs.o \
$(B)/main/game/ai_cast_script.o \
$(B)/main/game/ai_cast_script_actions.o \
$(B)/main/game/ai_cast_script_ents.o \
$(B)/main/game/ai_cast_sight.o \
$(B)/main/game/ai_cast_think.o \