74496edcb1c9917d2bb776c694fe64a04d882c9f
[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
11 # Makefile name
12 MAKEFILE=BSDmakefile
13
14 # Commands
15 CMD_RM=$(CMD_UNIXRM)
16 CMD_CP=$(CMD_UNIXCP)
17 CMD_MKDIR=$(CMD_UNIXMKDIR)
18
19 # default targets
20 TARGETS_DEBUG=sv-debug cl-debug sdl-debug
21 TARGETS_PROFILE=sv-profile cl-profile sdl-profile
22 TARGETS_RELEASE=sv-release cl-release sdl-release
23 TARGETS_RELEASE_PROFILE=sv-release-profile cl-release-profile sdl-release-profile
24 TARGETS_NEXUIZ=sv-nexuiz cl-nexuiz sdl-nexuiz
25
26 # X11 libs
27 UNIX_X11LIBPATH=/usr/X11R6/lib
28
29 # BSD configuration
30 .if $(DP_MAKE_TARGET) == "bsd"
31
32 # FreeBSD uses OSS
33 .if $(DP_ARCH) == "FreeBSD"
34 DEFAULT_SNDAPI=OSS
35 .else
36 DEFAULT_SNDAPI=BSD
37 .endif
38 OBJ_CD=$(OBJ_BSDCD)
39
40 OBJ_CL=$(OBJ_GLX)
41 OBJ_ICON=
42 OBJ_ICON_NEXUIZ=
43
44 LDFLAGS_CL=$(LDFLAGS_BSDCL)
45 LDFLAGS_SV=$(LDFLAGS_BSDSV)
46 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
47
48 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
49 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
50 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
51
52 EXE_CL=$(EXE_UNIXCL)
53 EXE_SV=$(EXE_UNIXSV)
54 EXE_SDL=$(EXE_UNIXSDL)
55 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
56 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
57 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
58
59 # set these to "" if you want to use dynamic loading instead
60 # zlib
61 CFLAGS_LIBZ=-DLINK_TO_ZLIB
62 LIB_Z=-lz
63
64 # jpeg
65 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
66 LIB_JPEG=-ljpeg
67
68 # ode
69 ODE_CONFIG?=ode-config
70 LIB_ODE=`$(ODE_CONFIG) --libs`
71 CFLAGS_ODE=`$(ODE_CONFIG) --cflags` -DUSEODE -DLINK_TO_LIBODE
72
73 # d0_blind_id
74 # most distros do not have d0_blind_id package, dlopen will used by default
75 # LIB_CRYPTO=-ld0_blind_id
76 # CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
77 # LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
78 # CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
79 LIB_CRYPTO=
80 CFLAGS_CRYPTO=
81 LIB_CRYPTO_RIJNDAEL=
82 CFLAGS_CRYPTO_RIJNDAEL=
83
84 # modplug
85 # now ogg is mostly used, modplug is required rarely, keep it dlopen by default
86 # LIB_SND_MODPLUG=-lmodplug
87 # CFLAGS_SND_MODPLUG=-DLINK_TO_LIBMODPLUG
88 LIB_SND_MODPLUG=
89 CFLAGS_SND_MODPLUG=
90
91 .endif
92
93
94 ##### Sound configuration #####
95
96 .ifndef DP_SOUND_API
97 DP_SOUND_API=$(DEFAULT_SNDAPI)
98 .endif
99
100 # NULL: no sound
101 .if $(DP_SOUND_API) == "NULL"
102 OBJ_SOUND=$(OBJ_SND_NULL)
103 LIB_SOUND=$(LIB_SND_NULL)
104 .endif
105
106 # OSS: Open Sound System
107 .if $(DP_SOUND_API) == "OSS"
108 OBJ_SOUND=$(OBJ_SND_OSS)
109 LIB_SOUND=$(LIB_SND_OSS)
110 .endif
111
112 # BSD: BSD / Sun audio API
113 .if $(DP_SOUND_API) == "BSD"
114 OBJ_SOUND=$(OBJ_SND_BSD)
115 LIB_SOUND=$(LIB_SND_BSD)
116 .endif
117
118
119 ##### Extra CFLAGS #####
120
121 CFLAGS_MAKEDEP=-MD
122 .ifdef DP_FS_BASEDIR
123 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
124 .else
125 CFLAGS_FS=
126 .endif
127
128 CFLAGS_PRELOAD=
129 .ifdef DP_PRELOAD_DEPENDENCIES
130 LDFLAGS_CL+=$(LDFLAGS_UNIXCL_PRELOAD)
131 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
132 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
133 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
134 .endif
135
136
137 ##### BSD Make specific definitions #####
138
139 MAKE:=$(MAKE) -f BSDmakefile
140
141 DO_LD=$(CC) -o ../../../$@ $> $(LDFLAGS)
142
143
144 ##### Definitions shared by all makefiles #####
145 .include "makefile.inc"