updates from Daniel Borca
[mesa.git] / src / mesa / Makefile.mgw
1 # Mesa 3-D graphics library
2 # Version: 5.1
3 #
4 # Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the "Software"),
8 # to deal in the Software without restriction, including without limitation
9 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 # and/or sell copies of the Software, and to permit persons to whom the
11 # Software is furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 # MinGW core makefile v1.0 for Mesa
24 #
25 # Copyright (C) 2002 - Borca Daniel
26 # Email : dborca@users.sourceforge.net
27 # Web : http://www.geocities.com/dborca
28
29
30 #
31 # Available options:
32 #
33 # Environment variables:
34 # CFLAGS
35 #
36 # GLIDE path to Glide3 SDK; used with FX.
37 # default = $(TOP)/glide3
38 # FX=1 build for 3dfx Glide3. Note that this disables
39 # compilation of most WMesa code and requires fxMesa.
40 # As a consequence, you'll need the Win32 Glide3
41 # library to build any application.
42 # default = no
43 # HAVE_X86=1 optimize for i386.
44 # default = no
45 # HAVE_MMX=1 allow MMX specializations, provided your assembler
46 # supports MMX instruction set. However, the true CPU
47 # capabilities are checked at run-time to avoid crashes.
48 # default = no
49 # HAVE_SSE=1 (see HAVE_MMX)
50 # default = no
51 # HAVE_3DNOW=1 (see HAVE_MMX)
52 # default = no
53 #
54 # Targets:
55 # all: build GL
56 # clean: remove object files
57 #
58
59
60
61 .PHONY: all clean
62 .INTERMEDIATE: x86/gen_matypes.exe
63 .SUFFIXES: .rc .res
64
65 TOP = ../..
66 GLIDE ?= $(TOP)/glide3
67 LIBDIR = $(TOP)/lib
68 GL_DLL = opengl32.dll
69 GL_IMP = libopengl32.a
70
71 LDLIBS = -lgdi32
72
73 CC = mingw32-gcc
74 CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_MSC_VER
75 CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
76 ifeq ($(FX),1)
77 CFLAGS += -DH3
78 CFLAGS += -I$(GLIDE)/include -DFX
79 LDLIBS += -L$(GLIDE)/lib -lglide3x
80 GL_DEF = drivers/glide/fxopengl.def
81 GL_RES = drivers/glide/fx.rc
82 else
83 GL_DEF = drivers/windows/gdi/mesa.def
84 endif
85
86 AR = ar
87 ARFLAGS = rus
88
89 ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
90 UNLINK = del $(subst /,\,$(1))
91 else
92 UNLINK = $(RM) $(1)
93 endif
94
95 MAIN_SOURCES = \
96 main/api_arrayelt.c \
97 main/api_loopback.c \
98 main/api_noop.c \
99 main/api_validate.c \
100 main/accum.c \
101 main/arbprogram.c \
102 main/arbfragparse.c \
103 main/arbvertparse.c \
104 main/attrib.c \
105 main/blend.c \
106 main/bufferobj.c \
107 main/buffers.c \
108 main/clip.c \
109 main/colortab.c \
110 main/context.c \
111 main/convolve.c \
112 main/debug.c \
113 main/depth.c \
114 main/dispatch.c \
115 main/dlist.c \
116 main/drawpix.c \
117 main/enable.c \
118 main/enums.c \
119 main/eval.c \
120 main/extensions.c \
121 main/feedback.c \
122 main/fog.c \
123 main/get.c \
124 main/hash.c \
125 main/hint.c \
126 main/histogram.c \
127 main/image.c \
128 main/imports.c \
129 main/light.c \
130 main/lines.c \
131 main/matrix.c \
132 main/nvprogram.c \
133 main/nvfragparse.c \
134 main/nvvertexec.c \
135 main/nvvertparse.c \
136 main/occlude.c \
137 main/pixel.c \
138 main/points.c \
139 main/polygon.c \
140 main/program.c \
141 main/rastpos.c \
142 main/state.c \
143 main/stencil.c \
144 main/texcompress.c \
145 main/texformat.c \
146 main/teximage.c \
147 main/texobj.c \
148 main/texstate.c \
149 main/texstore.c \
150 main/texutil.c \
151 main/varray.c \
152 main/vtxfmt.c
153
154 GLAPI_SOURCES = \
155 glapi/glapi.c \
156 glapi/glthread.c
157
158 MATH_SOURCES = \
159 math/m_debug_clip.c \
160 math/m_debug_norm.c \
161 math/m_debug_xform.c \
162 math/m_eval.c \
163 math/m_matrix.c \
164 math/m_translate.c \
165 math/m_vector.c \
166 math/m_xform.c
167
168 ARRAY_CACHE_SOURCES = \
169 array_cache/ac_context.c \
170 array_cache/ac_import.c
171
172 SWRAST_SOURCES = \
173 swrast/s_aaline.c \
174 swrast/s_aatriangle.c \
175 swrast/s_accum.c \
176 swrast/s_alpha.c \
177 swrast/s_alphabuf.c \
178 swrast/s_bitmap.c \
179 swrast/s_blend.c \
180 swrast/s_buffers.c \
181 swrast/s_copypix.c \
182 swrast/s_context.c \
183 swrast/s_depth.c \
184 swrast/s_drawpix.c \
185 swrast/s_feedback.c \
186 swrast/s_fog.c \
187 swrast/s_imaging.c \
188 swrast/s_lines.c \
189 swrast/s_logic.c \
190 swrast/s_masking.c \
191 swrast/s_nvfragprog.c \
192 swrast/s_pixeltex.c \
193 swrast/s_points.c \
194 swrast/s_readpix.c \
195 swrast/s_span.c \
196 swrast/s_stencil.c \
197 swrast/s_texture.c \
198 swrast/s_texstore.c \
199 swrast/s_triangle.c \
200 swrast/s_zoom.c
201
202 SWRAST_SETUP_SOURCES = \
203 swrast_setup/ss_context.c \
204 swrast_setup/ss_triangle.c \
205 swrast_setup/ss_vb.c
206
207 TNL_SOURCES = \
208 tnl/t_array_api.c \
209 tnl/t_array_import.c \
210 tnl/t_context.c \
211 tnl/t_eval_api.c \
212 tnl/t_imm_alloc.c \
213 tnl/t_imm_api.c \
214 tnl/t_imm_debug.c \
215 tnl/t_imm_dlist.c \
216 tnl/t_imm_elt.c \
217 tnl/t_imm_eval.c \
218 tnl/t_imm_exec.c \
219 tnl/t_imm_fixup.c \
220 tnl/t_pipeline.c \
221 tnl/t_vb_fog.c \
222 tnl/t_vb_light.c \
223 tnl/t_vb_normals.c \
224 tnl/t_vb_points.c \
225 tnl/t_vb_program.c \
226 tnl/t_vb_render.c \
227 tnl/t_vb_texgen.c \
228 tnl/t_vb_texmat.c \
229 tnl/t_vb_vertex.c
230
231 X86_SOURCES = \
232 x86/x86.c \
233 x86/glapi_x86.S \
234 x86/common_x86.c \
235 x86/common_x86_asm.S \
236 x86/x86_xform2.S \
237 x86/x86_xform3.S \
238 x86/x86_xform4.S \
239 x86/x86_cliptest.S
240
241 MMX_SOURCES = \
242 x86/mmx_blend.S
243
244 SSE_SOURCES = \
245 x86/sse.c \
246 x86/sse_xform2.S \
247 x86/sse_xform3.S \
248 x86/sse_xform4.S \
249 x86/sse_normal.S
250
251 K3D_SOURCES = \
252 x86/3dnow.c \
253 x86/3dnow_xform2.S \
254 x86/3dnow_xform3.S \
255 x86/3dnow_xform4.S \
256 x86/3dnow_normal.S
257
258 CORE_SOURCES = \
259 $(MAIN_SOURCES) \
260 $(GLAPI_SOURCES) \
261 $(MATH_SOURCES) \
262 $(ARRAY_CACHE_SOURCES) \
263 $(SWRAST_SOURCES) \
264 $(SWRAST_SETUP_SOURCES) \
265 $(TNL_SOURCES)
266
267 ifeq ($(HAVE_MMX),1)
268 X86_SOURCES += $(MMX_SOURCES)
269 CFLAGS += -DUSE_MMX_ASM
270 HAVE_X86 = 1
271 endif
272 ifeq ($(HAVE_SSE),1)
273 X86_SOURCES += $(SSE_SOURCES)
274 CFLAGS += -DUSE_SSE_ASM
275 HAVE_X86 = 1
276 endif
277 ifeq ($(HAVE_3DNOW),1)
278 X86_SOURCES += $(K3D_SOURCES)
279 CFLAGS += -DUSE_3DNOW_ASM
280 HAVE_X86 = 1
281 endif
282 ifeq ($(HAVE_X86),1)
283 CFLAGS += -DUSE_X86_ASM
284 else
285 X86_SOURCES =
286 endif
287
288 ifeq ($(FX),1)
289 DRIVER_SOURCES = \
290 drivers/glide/fxapi.c \
291 drivers/glide/fxdd.c \
292 drivers/glide/fxddspan.c \
293 drivers/glide/fxddtex.c \
294 drivers/glide/fxsetup.c \
295 drivers/glide/fxtexman.c \
296 drivers/glide/fxtris.c \
297 drivers/glide/fxvb.c \
298 drivers/glide/fxglidew.c \
299 drivers/glide/fxg.c \
300 drivers/glide/fxwgl.c
301 else
302 DRIVER_SOURCES = \
303 drivers/windows/gdi/wmesa.c \
304 drivers/windows/gdi/wgl.c
305 endif
306
307 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
308
309 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
310
311 X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
312
313 RESOURCE = $(GL_RES:.rc=.res)
314
315 .c.o:
316 $(CC) -o $@ $(CFLAGS) -c $<
317 .S.o:
318 $(CC) -o $@ $(CFLAGS) -c $<
319 .s.o:
320 $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
321 .rc.res:
322 windres -o $@ -Irc -Ocoff $<
323
324 all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
325
326 $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
327 dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) --target i386-mingw32 --def $(GL_DEF) $^ $(LDLIBS)
328
329 $(X86_OBJECTS): x86/matypes.h
330
331 x86/matypes.h: x86/gen_matypes.exe
332 $(subst /,\,$< > $@)
333
334 x86/gen_matypes.exe: x86/gen_matypes.c
335 $(CC) -o $@ $(CFLAGS) -s $<
336
337 # [dBorca] Hack alert:
338 # use standard API, to work around Win32 @x names
339 # also glapi_x86.S is protected against __WIN32__
340 main/dispatch.o: main/dispatch.c
341 $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
342
343 clean:
344 -$(call UNLINK,array_cache/*.o)
345 -$(call UNLINK,glapi/*.o)
346 -$(call UNLINK,main/*.o)
347 -$(call UNLINK,math/*.o)
348 -$(call UNLINK,swrast/*.o)
349 -$(call UNLINK,swrast_setup/*.o)
350 -$(call UNLINK,tnl/*.o)
351 -$(call UNLINK,x86/*.o)
352 -$(call UNLINK,drivers/windows/gdi/*.o)
353 -$(call UNLINK,drivers/glide/*.o)
354 -$(call UNLINK,drivers/glide/*.res)