Fix issue with noise during startup
[xonotic/darkplaces.git] / BSDmakefile
1 #####  DP_MAKE_TARGET autodetection and arch specific variables #####
2
3 .ifndef DP_MAKE_TARGET
4
5 DP_MAKE_TARGET=bsd
6
7 .endif
8 DP_ARCH != uname
9
10 # Makefile name
11 MAKEFILE=BSDmakefile
12
13 # Commands
14 CMD_RM=$(CMD_UNIXRM)
15 CMD_CP=$(CMD_UNIXCP)
16 CMD_MKDIR=$(CMD_UNIXMKDIR)
17
18 # default targets
19 TARGETS_DEBUG=sv-debug sdl-debug
20 TARGETS_PROFILE=sv-profile sdl-profile
21 TARGETS_RELEASE=sv-release sdl-release
22 TARGETS_RELEASE_PROFILE=sv-release-profile sdl-release-profile
23 TARGETS_NEXUIZ=sv-nexuiz sdl-nexuiz
24
25 # Link options
26 DP_LINK_ZLIB?=shared
27 DP_LINK_JPEG?=shared
28 DP_LINK_ODE?=dlopen
29 DP_LINK_CRYPTO?=dlopen
30 DP_LINK_CRYPTO_RIJNDAEL?=dlopen
31
32 ###### Optional features #####
33 DP_VIDEO_CAPTURE?=enabled
34 .if $(DP_VIDEO_CAPTURE) == "enabled"
35   CFLAGS_VIDEO_CAPTURE=-DCONFIG_VIDEO_CAPTURE
36   OBJ_VIDEO_CAPTURE = cap_avi.o cap_ogg.o
37 .else
38   CFLAGS_VIDEO_CAPTURE=
39   OBJ_VIDEO_CAPTURE =
40 .endif
41
42 # X11 libs
43 UNIX_X11LIBPATH=/usr/X11R6/lib
44
45 # BSD configuration
46 .if $(DP_MAKE_TARGET) == "bsd"
47
48 # FreeBSD uses OSS
49 .if $(DP_ARCH) == "FreeBSD"
50 DEFAULT_SNDAPI=OSS
51 .else
52 DEFAULT_SNDAPI=BSD
53 .endif
54
55 OBJ_ICON=
56 OBJ_ICON_NEXUIZ=
57
58 LDFLAGS_SV=$(LDFLAGS_BSDSV)
59 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
60
61 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
62 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
63 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
64
65 EXE_SV=$(EXE_UNIXSV)
66 EXE_SDL=$(EXE_UNIXSDL)
67 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
68 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
69
70 # set these to "" if you want to use dynamic loading instead
71 # zlib
72 .if $(DP_LINK_ZLIB) == "shared"
73 CFLAGS_LIBZ=-DLINK_TO_ZLIB
74 LIB_Z=-lz
75 .else
76 CFLAGS_LIBZ=
77 LIB_Z=
78 .endif
79
80 # jpeg
81 .if $(DP_LINK_JPEG) == "shared"
82 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
83 LIB_JPEG=-ljpeg
84 .else
85 CFLAGS_LIBJPEG=
86 LIB_JPEG=
87 .endif
88
89 # ode
90 .if $(DP_LINK_ODE) == "shared"
91 ODE_CONFIG?=ode-config
92 LIB_ODE=`$(ODE_CONFIG) --libs`
93 CFLAGS_ODE=`$(ODE_CONFIG) --cflags` -DUSEODE -DLINK_TO_LIBODE
94 .else
95 LIB_ODE=
96 CFLAGS_ODE=-DUSEODE
97 .endif
98
99 # d0_blind_id
100 .if $(DP_LINK_CRYPTO) == "shared"
101 LIB_CRYPTO=-ld0_blind_id
102 CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
103 .else
104 LIB_CRYPTO=
105 CFLAGS_CRYPTO=
106 .endif
107 .if $(DP_LINK_CRYPTO_RIJNDAEL) == "shared"
108 LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
109 CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
110 .else
111 LIB_CRYPTO_RIJNDAEL=
112 CFLAGS_CRYPTO_RIJNDAEL=
113 .endif
114
115 .endif
116
117
118 ##### Extra CFLAGS #####
119
120 CFLAGS_MAKEDEP=-MD
121 .ifdef DP_FS_BASEDIR
122 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
123 .else
124 CFLAGS_FS=
125 .endif
126
127 CFLAGS_PRELOAD=
128 .ifdef DP_PRELOAD_DEPENDENCIES
129 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
130 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
131 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
132 .endif
133
134 CFLAGS_NET=
135 # Systems without IPv6 support should uncomment this:
136 #CFLAGS_NET+=-DNOSUPPORTIPV6
137
138 ##### BSD Make specific definitions #####
139
140 MAKE:=$(MAKE) -f BSDmakefile
141
142 DO_LD=$(CC) -o ../../../$@ $> $(LDFLAGS)
143
144
145 ##### Definitions shared by all makefiles #####
146 .include "makefile.inc"