1 ##### DP_MAKE_TARGET autodetection and arch specific variables #####
11 DP_ARCH:=$(shell uname)
12 ifneq ($(filter %BSD,$(DP_ARCH)),)
15 ifeq ($(DP_ARCH), Darwin)
18 ifeq ($(DP_ARCH), SunOS)
23 endif # ifeq ($(DP_ARCH), SunOS)
24 endif # ifeq ($(DP_ARCH), Darwin)
25 endif # ifneq ($(filter %BSD,$(DP_ARCH)),)
27 endif # ifndef DP_MAKE_TARGET
29 # If we're not on compiling for Win32, we need additional information
30 ifneq ($(DP_MAKE_TARGET), mingw)
31 DP_ARCH:=$(shell uname)
32 DP_MACHINE:=$(shell uname -m)
36 # Command used to delete files
43 # 64bits AMD CPUs use another lib directory
44 ifeq ($(DP_MACHINE),x86_64)
45 UNIX_X11LIBPATH:=/usr/X11R6/lib64
47 UNIX_X11LIBPATH:=/usr/X11R6/lib
52 ifeq ($(DP_MAKE_TARGET), linux)
60 LDFLAGS_CL=$(LDFLAGS_LINUXCL)
61 LDFLAGS_SV=$(LDFLAGS_LINUXSV)
62 LDFLAGS_SDL=$(LDFLAGS_LINUXSDL)
64 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS)
65 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS)
66 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
70 EXE_SDL=$(EXE_UNIXSDL)
71 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
72 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
73 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
76 # Mac OS X configuration
77 ifeq ($(DP_MAKE_TARGET), macosx)
78 DEFAULT_SNDAPI=COREAUDIO
79 OBJ_CD=$(OBJ_MACOSXCD)
85 LDFLAGS_CL=$(LDFLAGS_MACOSXCL)
86 LDFLAGS_SV=$(LDFLAGS_MACOSXSV)
87 LDFLAGS_SDL=$(LDFLAGS_MACOSXSDL)
89 SDLCONFIG_CFLAGS=$(SDLCONFIG_MACOSXCFLAGS)
90 SDLCONFIG_LIBS=$(SDLCONFIG_MACOSXLIBS)
91 SDLCONFIG_STATICLIBS=$(SDLCONFIG_MACOSXSTATICLIBS)
93 EXE_CL=$(EXE_MACOSXCL)
95 EXE_SDL=$(EXE_UNIXSDL)
96 EXE_CLNEXUIZ=$(EXE_MACOSXCLNEXUIZ)
97 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
98 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
100 ifeq ($(word 2, $(filter -arch, $(CC))), -arch)
105 # SunOS configuration (Solaris)
106 ifeq ($(DP_MAKE_TARGET), sunos)
108 OBJ_CD=$(OBJ_SUNOSCD)
114 CFLAGS_EXTRA=$(CFLAGS_SUNOS)
116 LDFLAGS_CL=$(LDFLAGS_SUNOSCL)
117 LDFLAGS_SV=$(LDFLAGS_SUNOSSV)
118 LDFLAGS_SDL=$(LDFLAGS_SUNOSSDL)
120 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS)
121 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS)
122 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
126 EXE_SDL=$(EXE_UNIXSDL)
127 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
128 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
129 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
133 ifeq ($(DP_MAKE_TARGET), bsd)
134 ifeq ($(DP_ARCH),FreeBSD)
145 LDFLAGS_CL=$(LDFLAGS_BSDCL)
146 LDFLAGS_SV=$(LDFLAGS_BSDSV)
147 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
149 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS)
150 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS)
151 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
155 EXE_SDL=$(EXE_UNIXSDL)
156 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
157 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
158 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
161 # Win32 configuration
162 ifeq ($(DP_MAKE_TARGET), mingw)
167 OBJ_ICON=darkplaces.o
168 OBJ_ICON_NEXUIZ=nexuiz.o
170 LDFLAGS_CL=$(LDFLAGS_WINCL)
171 LDFLAGS_SV=$(LDFLAGS_WINSV)
172 LDFLAGS_SDL=$(LDFLAGS_WINSDL)
174 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS)
175 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS)
176 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
180 EXE_SDL=$(EXE_WINSDL)
181 EXE_CLNEXUIZ=$(EXE_WINCLNEXUIZ)
182 EXE_SVNEXUIZ=$(EXE_WINSVNEXUIZ)
183 EXE_SDLNEXUIZ=$(EXE_WINSDLNEXUIZ)
186 ifeq ($(WIN32RELEASE), 1)
187 CPUOPTIMIZATIONS=-march=i686 -DSUPPORTDIRECTX -DUSE_WSPIAPI_H
190 ifeq ($(WIN64RELEASE), 1)
194 ##### Sound configuration #####
197 DP_SOUND_API=$(DEFAULT_SNDAPI)
201 ifeq ($(DP_SOUND_API), NULL)
202 OBJ_SOUND=$(OBJ_SND_NULL)
203 LIB_SOUND=$(LIB_SND_NULL)
206 # OSS: Open Sound System
207 ifeq ($(DP_SOUND_API), OSS)
208 OBJ_SOUND=$(OBJ_SND_OSS)
209 LIB_SOUND=$(LIB_SND_OSS)
212 # ALSA: Advanced Linux Sound Architecture
213 ifeq ($(DP_SOUND_API), ALSA)
214 OBJ_SOUND=$(OBJ_SND_ALSA)
215 LIB_SOUND=$(LIB_SND_ALSA)
218 # COREAUDIO: Core Audio
219 ifeq ($(DP_SOUND_API), COREAUDIO)
220 OBJ_SOUND=$(OBJ_SND_COREAUDIO)
221 LIB_SOUND=$(LIB_SND_COREAUDIO)
224 # BSD: BSD / Sun audio API
225 ifeq ($(DP_SOUND_API), BSD)
226 OBJ_SOUND=$(OBJ_SND_BSD)
227 LIB_SOUND=$(LIB_SND_BSD)
230 # WIN: DirectX and Win32 WAVE output
231 ifeq ($(DP_SOUND_API), WIN)
232 OBJ_SOUND=$(OBJ_SND_WIN)
233 LIB_SOUND=$(LIB_SND_WIN)
236 ifeq ($(DP_SOUND_API),3DRAS)
237 OBJ_SOUND=$(OBJ_SND_3DRAS)
238 LIB_SOUND=$(LIB_SND_3DRAS)
241 ##### Extra CFLAGS #####
245 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
251 ifneq ($(DP_MAKE_TARGET), mingw)
252 ifdef DP_PRELOAD_DEPENDENCIES
253 # DP_PRELOAD_DEPENDENCIES: when set, link against the libraries needed using -l
254 # dynamically so they won't get loaded at runtime using dlopen
255 LDFLAGS_CL+=$(LDFLAGS_UNIXCL_PRELOAD)
256 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
257 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
258 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
262 ifdef DP_LINK_TO_LIBJPEG
263 LDFLAGS_LIBJPEG?=-ljpeg
264 LDFLAGS_CL+=$(LDFLAGS_LIBJPEG)
265 LDFLAGS_SV+=$(LDFLAGS_LIBJPEG)
266 LDFLAGS_SDL+=$(LDFLAGS_LIBJPEG)
267 CFLAGS_PRELOAD+=$(CFLAGS_LIBJPEG) -DLINK_TO_LIBJPEG
270 ##### GNU Make specific definitions #####
272 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
275 ##### Definitions shared by all makefiles #####
279 ##### Dependency files #####