Changes necessary to build and run on Solaris 10 x86
[divverent/darkplaces.git] / makefile
1 #####  DP_MAKE_TARGET autodetection and arch specific variables ##### 
2
3 ifndef DP_MAKE_TARGET
4
5 # Win32
6 ifdef windir
7         DP_MAKE_TARGET=mingw
8 else
9
10 # UNIXes
11 DP_ARCH:=$(shell uname)
12 ifneq ($(filter %BSD,$(DP_ARCH)),)
13         DP_MAKE_TARGET=bsd
14 else
15 ifeq ($(DP_ARCH), Darwin)
16         DP_MAKE_TARGET=macosx
17 else
18 ifeq ($(DP_ARCH), SunOS)
19         DP_MAKE_TARGET=sunos
20 else
21         DP_MAKE_TARGET=linux
22
23 endif  # ifeq ($(DP_ARCH), SunOS)
24 endif  # ifeq ($(DP_ARCH), Darwin)
25 endif  # ifneq ($(filter %BSD,$(DP_ARCH)),)
26 endif  # ifdef windir
27 endif  # ifndef DP_MAKE_TARGET
28
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)
33 endif
34
35
36 # Command used to delete files
37 ifdef windir
38         CMD_RM=del
39 else
40         CMD_RM=$(CMD_UNIXRM)
41 endif
42
43 # 64bits AMD CPUs use another lib directory
44 ifeq ($(DP_MACHINE),x86_64)
45         UNIX_X11LIBPATH:=-L/usr/X11R6/lib64
46 else
47         UNIX_X11LIBPATH:=-L/usr/X11R6/lib
48 endif
49
50
51 # Linux configuration
52 ifeq ($(DP_MAKE_TARGET), linux)
53         OBJ_SOUND=$(OBJ_LINUXSOUND)
54         LIB_SOUND=$(LIB_LINUXSOUND)
55         OBJ_CD=$(OBJ_LINUXCD)
56
57         OBJ_CL=$(OBJ_GLX)
58
59         LDFLAGS_CL=$(LDFLAGS_LINUXCL)
60         LDFLAGS_SV=$(LDFLAGS_LINUXSV)
61         LDFLAGS_SDL=$(LDFLAGS_LINUXSDL)
62
63         EXE_CL=$(EXE_UNIXCL)
64         EXE_SV=$(EXE_UNIXSV)
65         EXE_SDL=$(EXE_UNIXSDL)
66 endif
67
68 # Mac OS X configuration
69 ifeq ($(DP_MAKE_TARGET), macosx)
70         OBJ_SOUND=$(OBJ_MACOSXSOUND)
71         LIB_SOUND=$(LIB_MACOSXSOUND)
72         OBJ_CD=$(OBJ_MACOSXCD)
73
74         OBJ_CL=$(OBJ_AGL)
75
76         LDFLAGS_CL=$(LDFLAGS_MACOSXCL)
77         LDFLAGS_SV=$(LDFLAGS_MACOSXSV)
78         LDFLAGS_SDL=$(LDFLAGS_MACOSXSDL)
79
80         EXE_CL=$(EXE_UNIXCL)
81         EXE_SV=$(EXE_UNIXSV)
82         EXE_SDL=$(EXE_UNIXSDL)
83 endif
84
85 # SunOS configuration (Solaris)
86 ifeq ($(DP_MAKE_TARGET), sunos)
87         OBJ_SOUND=$(OBJ_SUNOSSOUND)
88         LIB_SOUND=$(LIB_SUNOSSOUND)
89         OBJ_CD=$(OBJ_SUNOSCD)
90
91         OBJ_CL=$(OBJ_GLX)
92
93         CFLAGS_EXTRA=$(CFLAGS_SUNOS)
94
95         LDFLAGS_CL=$(LDFLAGS_SUNOSCL)
96         LDFLAGS_SV=$(LDFLAGS_SUNOSSV)
97         LDFLAGS_SDL=$(LDFLAGS_SUNOSSDL)
98
99         EXE_CL=$(EXE_UNIXCL)
100         EXE_SV=$(EXE_UNIXSV)
101         EXE_SDL=$(EXE_UNIXSDL)
102 endif
103
104 # BSD configuration
105 ifeq ($(DP_MAKE_TARGET), bsd)
106 ifeq ($(DP_ARCH),FreeBSD)
107         OBJ_SOUND=$(OBJ_OSSSOUND)
108         LIB_SOUND=$(LIB_OSSSOUND)
109 else
110         OBJ_SOUND=$(OBJ_BSDSOUND)
111         LIB_SOUND=$(LIB_BSDSOUND)
112 endif
113         OBJ_CD=$(OBJ_BSDCD)
114
115         OBJ_CL=$(OBJ_GLX)
116
117         LDFLAGS_CL=$(LDFLAGS_BSDCL)
118         LDFLAGS_SV=$(LDFLAGS_BSDSV)
119         LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
120
121         EXE_CL=$(EXE_UNIXCL)
122         EXE_SV=$(EXE_UNIXSV)
123         EXE_SDL=$(EXE_UNIXSDL)
124 endif
125
126 # Win32 configuration
127 ifeq ($(DP_MAKE_TARGET), mingw)
128         OBJ_SOUND=$(OBJ_WINSOUND)
129         LIB_SOUND=$(LIB_WINSOUND)
130         OBJ_CD=$(OBJ_WINCD)
131
132         OBJ_CL=$(OBJ_WGL)
133
134         LDFLAGS_CL=$(LDFLAGS_WINCL)
135         LDFLAGS_SV=$(LDFLAGS_WINSV)
136         LDFLAGS_SDL=$(LDFLAGS_WINSDL)
137
138         EXE_CL=$(EXE_WINCL)
139         EXE_SV=$(EXE_WINSV)
140         EXE_SDL=$(EXE_WINSDL)
141 endif
142
143
144 ##### GNU Make specific definitions #####
145
146 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
147
148
149 ##### Definitions shared by all makefiles #####
150 include makefile.inc
151
152
153 ##### Dependency files #####
154
155 -include *.d