forked from QW-Group/mvdsv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.GNU
178 lines (159 loc) · 3.85 KB
/
Makefile.GNU
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
#
# QuakeWorld/MVDSV Makefile for Linux and SunOS
#
# GNU Make required
#
# ELF only
#
# $Id$
#
SV_DIR = ./src
# to compile mvdsv as 32bit on 64bit target platform use next:
# for gcc its like: make mvdsv FORCE32BITFLAGS=-m32
# configure script add FORCE32BITFLAGS=-m32
BASE_CFLAGS=-Wall -pipe -funsigned-char -DSERVERONLY -DUSE_PR2 -D$(BYTE_ORDER)Q__ $(FORCE32BITFLAGS)
WITH_OPTIMIZED_CFLAGS=YES
# libcurl support
ifeq ($(shell pkg-config --exists libcurl && echo 1),1)
CURL_CFLAGS = `pkg-config libcurl --cflags`
CURL_LIBS = `pkg-config libcurl --libs`
endif
USE_ASM=-Did386
ifeq ($(WITH_OPTIMIZED_CFLAGS),YES)
ifeq ($(ARCH),x86)
ifneq ($(UNAME),Darwin)
ifneq ($(UNAME),MacOSX)
ASM=$(USE_ASM)
endif
endif
endif
CFLAGS=$(ASM) $(BASE_CFLAGS) -O2 -fno-strict-aliasing -ffast-math -funroll-loops
else
CFLAGS=$(BASE_CFLAGS) -Wsign-compare -ggdb
endif
LDFLAGS=-lm
ASMFLAGS=-DELF -x assembler-with-cpp
ifeq ($(UNAME),Linux)
LDFLAGS+=-ldl
CFLAGS+= -pthread
STRIP=-strip
STRIP_FLAGS=--strip-unneeded --remove-section=.comment mvdsv
else
ifeq ($(UNAME),SunOS)
LDFLAGS+= -lsocket -lnsl
CFLAGS+= -pthread -DBSD_COMP
else
ifeq ($(UNAME),CYGWIN_NT-10.0)
LDFLAGS += -Lmingw32-libs/lib -static -lws2_32 -lwinmm
CFLAGS += -D_WIN32_WINNT=0x0501 -D_USE_32BIT_TIME_T -D__USE_MINGW_ANSI_STDIO -D_CONSOLE
STRIP=-strip
STRIP_FLAGS=--strip-unneeded --remove-section=.comment mvdsv
ASMFLAGS = -x assembler-with-cpp
else
CFLAGS+= -pthread
endif
endif
endif
ifdef CURL_CFLAGS
CFLAGS += $(CURL_CFLAGS)
CFLAGS += -DWWW_INTEGRATION
LDFLAGS += $(CURL_LIBS)
endif
ifeq ($(CC_BASEVERSION),4) # if gcc4 then build universal binary
ifeq ($(UNAME),Darwin)
CFLAGS+= -arch ppc -arch i386
endif
ifeq ($(UNAME),MacOSX)
CFLAGS+= -arch ppc -arch i386
endif
endif
#############################################################################
# SERVER
#############################################################################
SV_OBJS += \
$(SV_DIR)/pr_cmds.o \
$(SV_DIR)/pr_edict.o \
$(SV_DIR)/pr_exec.o \
\
$(SV_DIR)/pr2_cmds.o \
$(SV_DIR)/pr2_edict.o \
$(SV_DIR)/pr2_exec.o \
$(SV_DIR)/vm.o \
$(SV_DIR)/vm_interpreted.o \
$(SV_DIR)/vm_x86.o \
\
$(SV_DIR)/sv_ccmds.o \
$(SV_DIR)/sv_demo.o \
$(SV_DIR)/sv_demo_misc.o \
$(SV_DIR)/sv_demo_qtv.o \
$(SV_DIR)/sv_ents.o \
$(SV_DIR)/sv_init.o \
$(SV_DIR)/sv_login.o \
$(SV_DIR)/sv_main.o \
$(SV_DIR)/sv_master.o \
$(SV_DIR)/sv_mod_frags.o \
$(SV_DIR)/sv_move.o \
$(SV_DIR)/sv_nchan.o \
$(SV_DIR)/sv_phys.o \
$(SV_DIR)/sv_send.o \
$(SV_DIR)/sv_user.o \
$(SV_DIR)/sv_save.o \
\
$(SV_DIR)/bothtools.o \
$(SV_DIR)/cmd.o \
$(SV_DIR)/common.o \
$(SV_DIR)/cmodel.o \
$(SV_DIR)/crc.o \
$(SV_DIR)/cvar.o \
$(SV_DIR)/hash.o \
$(SV_DIR)/fs.o \
$(SV_DIR)/vfs_os.o \
$(SV_DIR)/vfs_pak.o \
$(SV_DIR)/mathlib.o \
$(SV_DIR)/md4.o \
$(SV_DIR)/net_chan.o \
$(SV_DIR)/net.o \
$(SV_DIR)/pmove.o \
$(SV_DIR)/pmovetst.o \
$(SV_DIR)/sha1.o \
$(SV_DIR)/sha3.o \
$(SV_DIR)/build.o \
$(SV_DIR)/world.o \
$(SV_DIR)/zone.o \
\
$(SV_DIR)/pcre/get.o \
$(SV_DIR)/pcre/pcre.o \
ifdef CURL_CFLAGS
SV_WEB_INTEGRATION = $(SV_DIR)/central.o
endif
ifeq ($(USE_ASM),$(ASM))
SV_ASM_OBJS = \
$(SV_DIR)/bothtoolsa.o \
$(SV_DIR)/math.o
endif
#############################################################################
# SETUP AND BUILD
#############################################################################
# Define V=1 to show command line.
ifdef V
Q :=
E := @true
else
Q := @
E := @echo
endif
.c.o :
$(E) [CC] $@
$(Q)$(CC) $(CFLAGS) -c $< -o $@
.s.o :
$(E) [ASM] $@
$(Q)$(CC) $(CFLAGS) $(ASMFLAGS) -c $< -o $@
all : mvdsv
$(E) [STRIP]
$(Q)$(STRIP) $(STRIP_FLAGS)
mvdsv : $(SV_WEB_INTEGRATION) $(SV_OBJS) $(SV_ASM_OBJS)
$(E) [LINK]
$(Q)$(CC) $(CFLAGS) -o mvdsv $^ $(LDFLAGS)
clean :
$(E) [CLEAN]
$(Q)-rm -f $(SV_DIR)/core $(SV_DIR)/*.o $(SV_DIR)/pcre/*.o mvdsv