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) $(SDLCONFIG_UNIXCFLAGS_X11)
65 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
66 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
70 EXE_SDL=$(EXE_UNIXSDL)
71 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
72 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
73 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
75 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
76 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
80 # Mac OS X configuration
81 ifeq ($(DP_MAKE_TARGET), macosx)
82 DEFAULT_SNDAPI=COREAUDIO
83 OBJ_CD=$(OBJ_MACOSXCD)
89 LDFLAGS_CL=$(LDFLAGS_MACOSXCL)
90 LDFLAGS_SV=$(LDFLAGS_MACOSXSV)
91 LDFLAGS_SDL=$(LDFLAGS_MACOSXSDL)
93 SDLCONFIG_CFLAGS=$(SDLCONFIG_MACOSXCFLAGS)
94 SDLCONFIG_LIBS=$(SDLCONFIG_MACOSXLIBS)
95 SDLCONFIG_STATICLIBS=$(SDLCONFIG_MACOSXSTATICLIBS)
97 EXE_CL=$(EXE_MACOSXCL)
99 EXE_SDL=$(EXE_UNIXSDL)
100 EXE_CLNEXUIZ=$(EXE_MACOSXCLNEXUIZ)
101 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
102 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
104 ifeq ($(word 2, $(filter -arch, $(CC))), -arch)
108 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
109 # 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
114 # SunOS configuration (Solaris)
115 ifeq ($(DP_MAKE_TARGET), sunos)
117 OBJ_CD=$(OBJ_SUNOSCD)
123 CFLAGS_EXTRA=$(CFLAGS_SUNOS)
125 LDFLAGS_CL=$(LDFLAGS_SUNOSCL)
126 LDFLAGS_SV=$(LDFLAGS_SUNOSSV)
127 LDFLAGS_SDL=$(LDFLAGS_SUNOSSDL)
129 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
130 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
131 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
135 EXE_SDL=$(EXE_UNIXSDL)
136 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
137 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
138 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
140 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
141 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
146 ifeq ($(DP_MAKE_TARGET), bsd)
147 ifeq ($(DP_ARCH),FreeBSD)
158 LDFLAGS_CL=$(LDFLAGS_BSDCL)
159 LDFLAGS_SV=$(LDFLAGS_BSDSV)
160 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
162 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
163 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
164 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
168 EXE_SDL=$(EXE_UNIXSDL)
169 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
170 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
171 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
173 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
174 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
178 # Win32 configuration
179 ifeq ($(WIN32RELEASE), 1)
180 # TARGET=i686-pc-mingw32
182 # WINDRES=$(TARGET)-windres
183 CPUOPTIMIZATIONS=-march=i686 -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math
184 # CPUOPTIMIZATIONS+=-DUSE_WSPIAPI_H -DSUPPORTIPV6
185 LDFLAGS_WINCOMMON=-Wl,--large-address-aware
190 ifeq ($(WIN64RELEASE), 1)
191 # TARGET=x86_64-pc-mingw32
193 # WINDRES=$(TARGET)-windres
197 CFLAGS_D3D=-DSUPPORTD3D -DSUPPORTDIRECTX
198 CFLAGS_WARNINGS=-Wall
202 CFLAGS_WARNINGS=-Wall -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement
207 ifeq ($(DP_MAKE_TARGET), mingw)
212 OBJ_ICON=darkplaces.o
213 OBJ_ICON_NEXUIZ=nexuiz.o
215 LDFLAGS_CL=$(LDFLAGS_WINCL)
216 LDFLAGS_SV=$(LDFLAGS_WINSV)
217 LDFLAGS_SDL=$(LDFLAGS_WINSDL)
219 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS)
220 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS)
221 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS)
225 EXE_SDL=$(EXE_WINSDL)
226 EXE_CLNEXUIZ=$(EXE_WINCLNEXUIZ)
227 EXE_SVNEXUIZ=$(EXE_WINSVNEXUIZ)
228 EXE_SDLNEXUIZ=$(EXE_WINSDLNEXUIZ)
230 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
231 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
235 ##### Sound configuration #####
238 DP_SOUND_API=$(DEFAULT_SNDAPI)
242 ifeq ($(DP_SOUND_API), NULL)
243 OBJ_SOUND=$(OBJ_SND_NULL)
244 LIB_SOUND=$(LIB_SND_NULL)
247 # OSS: Open Sound System
248 ifeq ($(DP_SOUND_API), OSS)
249 OBJ_SOUND=$(OBJ_SND_OSS)
250 LIB_SOUND=$(LIB_SND_OSS)
253 # ALSA: Advanced Linux Sound Architecture
254 ifeq ($(DP_SOUND_API), ALSA)
255 OBJ_SOUND=$(OBJ_SND_ALSA)
256 LIB_SOUND=$(LIB_SND_ALSA)
259 # COREAUDIO: Core Audio
260 ifeq ($(DP_SOUND_API), COREAUDIO)
261 OBJ_SOUND=$(OBJ_SND_COREAUDIO)
262 LIB_SOUND=$(LIB_SND_COREAUDIO)
265 # BSD: BSD / Sun audio API
266 ifeq ($(DP_SOUND_API), BSD)
267 OBJ_SOUND=$(OBJ_SND_BSD)
268 LIB_SOUND=$(LIB_SND_BSD)
271 # WIN: DirectX and Win32 WAVE output
272 ifeq ($(DP_SOUND_API), WIN)
273 OBJ_SOUND=$(OBJ_SND_WIN)
274 LIB_SOUND=$(LIB_SND_WIN)
277 ifeq ($(DP_SOUND_API),3DRAS)
278 OBJ_SOUND=$(OBJ_SND_3DRAS)
279 LIB_SOUND=$(LIB_SND_3DRAS)
282 ##### Extra CFLAGS #####
286 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
292 ifneq ($(DP_MAKE_TARGET), mingw)
293 ifdef DP_PRELOAD_DEPENDENCIES
294 # DP_PRELOAD_DEPENDENCIES: when set, link against the libraries needed using -l
295 # dynamically so they won't get loaded at runtime using dlopen
296 LDFLAGS_CL+=$(LDFLAGS_UNIXCL_PRELOAD)
297 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
298 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
299 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
303 ##### GNU Make specific definitions #####
305 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
308 ##### Definitions shared by all makefiles #####
312 ##### Dependency files #####