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
51 TARGETS_DEBUG=sv-debug cl-debug sdl-debug
52 TARGETS_PROFILE=sv-profile cl-profile sdl-profile
53 TARGETS_RELEASE=sv-release cl-release sdl-release
54 TARGETS_RELEASE_PROFILE=sv-release-profile cl-release-profile sdl-release-profile
55 TARGETS_NEXUIZ=sv-nexuiz cl-nexuiz sdl-nexuiz
58 ifeq ($(DP_MAKE_TARGET), linux)
66 LDFLAGS_CL=$(LDFLAGS_LINUXCL)
67 LDFLAGS_SV=$(LDFLAGS_LINUXSV)
68 LDFLAGS_SDL=$(LDFLAGS_LINUXSDL)
70 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
71 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
72 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
76 EXE_SDL=$(EXE_UNIXSDL)
77 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
78 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
79 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
81 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
82 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
86 # Mac OS X configuration
87 ifeq ($(DP_MAKE_TARGET), macosx)
88 DEFAULT_SNDAPI=COREAUDIO
89 OBJ_CD=$(OBJ_MACOSXCD)
95 LDFLAGS_CL=$(LDFLAGS_MACOSXCL)
96 LDFLAGS_SV=$(LDFLAGS_MACOSXSV)
97 LDFLAGS_SDL=$(LDFLAGS_MACOSXSDL)
99 SDLCONFIG_CFLAGS=$(SDLCONFIG_MACOSXCFLAGS)
100 SDLCONFIG_LIBS=$(SDLCONFIG_MACOSXLIBS)
101 SDLCONFIG_STATICLIBS=$(SDLCONFIG_MACOSXSTATICLIBS)
103 EXE_CL=$(EXE_MACOSXCL)
105 EXE_SDL=$(EXE_UNIXSDL)
106 EXE_CLNEXUIZ=$(EXE_MACOSXCLNEXUIZ)
107 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
108 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
110 ifeq ($(word 2, $(filter -arch, $(CC))), -arch)
114 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
115 # we don't currently link to libjpeg on Mac because the OS does not have an easy way to load libjpeg and we provide our own in the .app
119 # on OS X, we don't build the CL by default because it uses deprecated
120 # and not-implemented-in-64bit Carbon
121 TARGETS_DEBUG=sv-debug sdl-debug
122 TARGETS_PROFILE=sv-profile sdl-profile
123 TARGETS_RELEASE=sv-release sdl-release
124 TARGETS_RELEASE_PROFILE=sv-release-profile sdl-release-profile
125 TARGETS_NEXUIZ=sv-nexuiz sdl-nexuiz
128 # SunOS configuration (Solaris)
129 ifeq ($(DP_MAKE_TARGET), sunos)
131 OBJ_CD=$(OBJ_SUNOSCD)
137 CFLAGS_EXTRA=$(CFLAGS_SUNOS)
139 LDFLAGS_CL=$(LDFLAGS_SUNOSCL)
140 LDFLAGS_SV=$(LDFLAGS_SUNOSSV)
141 LDFLAGS_SDL=$(LDFLAGS_SUNOSSDL)
143 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
144 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
145 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
149 EXE_SDL=$(EXE_UNIXSDL)
150 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
151 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
152 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
154 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
155 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
160 ifeq ($(DP_MAKE_TARGET), bsd)
161 ifeq ($(DP_ARCH),FreeBSD)
172 LDFLAGS_CL=$(LDFLAGS_BSDCL)
173 LDFLAGS_SV=$(LDFLAGS_BSDSV)
174 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
176 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
177 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
178 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
182 EXE_SDL=$(EXE_UNIXSDL)
183 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
184 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
185 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
187 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
188 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
192 # Win32 configuration
193 ifeq ($(WIN32RELEASE), 1)
194 # TARGET=i686-pc-mingw32
196 # WINDRES=$(TARGET)-windres
197 CPUOPTIMIZATIONS=-march=i686 -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math
198 # CPUOPTIMIZATIONS+=-DUSE_WSPIAPI_H -DSUPPORTIPV6
199 LDFLAGS_WINCOMMON=-Wl,--large-address-aware
204 ifeq ($(WIN64RELEASE), 1)
205 # TARGET=x86_64-pc-mingw32
207 # WINDRES=$(TARGET)-windres
211 CFLAGS_D3D=-DSUPPORTD3D -DSUPPORTDIRECTX
212 CFLAGS_WARNINGS=-Wall
216 CFLAGS_WARNINGS=-Wall -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement
221 ifeq ($(DP_MAKE_TARGET), mingw)
226 OBJ_ICON=darkplaces.o
227 OBJ_ICON_NEXUIZ=nexuiz.o
229 LDFLAGS_CL=$(LDFLAGS_WINCL)
230 LDFLAGS_SV=$(LDFLAGS_WINSV)
231 LDFLAGS_SDL=$(LDFLAGS_WINSDL)
233 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS)
234 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS)
235 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
239 EXE_SDL=$(EXE_WINSDL)
240 EXE_CLNEXUIZ=$(EXE_WINCLNEXUIZ)
241 EXE_SVNEXUIZ=$(EXE_WINSVNEXUIZ)
242 EXE_SDLNEXUIZ=$(EXE_WINSDLNEXUIZ)
244 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
245 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
249 ##### Sound configuration #####
252 DP_SOUND_API=$(DEFAULT_SNDAPI)
256 ifeq ($(DP_SOUND_API), NULL)
257 OBJ_SOUND=$(OBJ_SND_NULL)
258 LIB_SOUND=$(LIB_SND_NULL)
261 # OSS: Open Sound System
262 ifeq ($(DP_SOUND_API), OSS)
263 OBJ_SOUND=$(OBJ_SND_OSS)
264 LIB_SOUND=$(LIB_SND_OSS)
267 # ALSA: Advanced Linux Sound Architecture
268 ifeq ($(DP_SOUND_API), ALSA)
269 OBJ_SOUND=$(OBJ_SND_ALSA)
270 LIB_SOUND=$(LIB_SND_ALSA)
273 # COREAUDIO: Core Audio
274 ifeq ($(DP_SOUND_API), COREAUDIO)
275 OBJ_SOUND=$(OBJ_SND_COREAUDIO)
276 LIB_SOUND=$(LIB_SND_COREAUDIO)
279 # BSD: BSD / Sun audio API
280 ifeq ($(DP_SOUND_API), BSD)
281 OBJ_SOUND=$(OBJ_SND_BSD)
282 LIB_SOUND=$(LIB_SND_BSD)
285 # WIN: DirectX and Win32 WAVE output
286 ifeq ($(DP_SOUND_API), WIN)
287 OBJ_SOUND=$(OBJ_SND_WIN)
288 LIB_SOUND=$(LIB_SND_WIN)
291 ifeq ($(DP_SOUND_API),3DRAS)
292 OBJ_SOUND=$(OBJ_SND_3DRAS)
293 LIB_SOUND=$(LIB_SND_3DRAS)
296 ##### Extra CFLAGS #####
300 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
306 ifneq ($(DP_MAKE_TARGET), mingw)
307 ifdef DP_PRELOAD_DEPENDENCIES
308 # DP_PRELOAD_DEPENDENCIES: when set, link against the libraries needed using -l
309 # dynamically so they won't get loaded at runtime using dlopen
310 LDFLAGS_CL+=$(LDFLAGS_UNIXCL_PRELOAD)
311 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
312 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
313 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
317 ##### GNU Make specific definitions #####
319 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
322 ##### Definitions shared by all makefiles #####
326 ##### Dependency files #####