added _NEW_PROGRAM to check_state flags for pipeline stages (fixes vparray demo bug)
[mesa.git] / src / mesa / Makefile.wfx
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 # Win32/FX core makefile for Mesa
24 #
25 # Copyright (c) 2003 - Hiroshi Morii
26 # Email : koolsmoky@users.sourceforge.net
27 # URL : http://www.3dfxzone.it/koolsmoky
28
29 # Debug build : nmake -f Makefile.fx.win32 DEBUG=1
30 # Optimized build : nmake -f Makefile.fx.win32
31 # Remove objects : nmake -f Makefile.fx.win32 clean
32 # Remove files in bin, lib : nmake -f Makefile.fx.win32 clobber
33 # Remove all generated files : nmake -f Makefile.fx.win32 realclean
34
35 .SUFFIXES: .S
36 ##################################
37 # general
38 ##################################
39 BUILDROOT = ..\..
40
41 !if "$(GLIDE3SDK)"==""
42 GLIDE3SDK = $(BUILDROOT)\glide3
43 !endif
44
45 !if "$(GLIDE3SDK)"==""
46 !error GLIDE3SDK undefined! Need to specify Glide3x SDK path!
47 !endif
48
49 GLIDE3LIB = $(GLIDE3SDK)\lib\glide3x.lib
50 TEXUS2LIB = #$(GLIDE3SDK)\lib\texus2.lib
51 LIBDIR = $(BUILDROOT)\lib
52 GL_DLL = OpenGL32.dll
53
54 HAVE_X86 = 1
55 HAVE_MMX = 1
56 HAVE_SSE =
57 HAVE_3DNOW = 1
58
59 ##################################
60 # build flags
61 ##################################
62 FLAGS = -DH3 -DFX -DBUILD_GL32
63
64 !if "$(USE_IEEE)"=="1"
65 FLAGS = $(FLAGS) -D__i386__
66 !endif
67
68 !if "$(HAVE_MMX)"=="1"
69 FLAGS = $(FLAGS) -DUSE_MMX_ASM
70 !endif
71 !if "$(HAVE_SSE)"=="1"
72 FLAGS = $(FLAGS) -DUSE_SSE_ASM
73 !endif
74 !if "$(HAVE_3DNOW)"=="1"
75 FLAGS = $(FLAGS) -DUSE_3DNOW_ASM
76 !endif
77 !if "$(HAVE_X86)"=="1"
78 FLAGS = $(FLAGS) -DUSE_X86_ASM
79 !endif
80
81 !if "$(DEBUG)" == "1"
82 FLAGS = $(FLAGS) -DMESA_DEBUG -DFX_DEBUG
83 !endif
84
85 ##################################
86 # compiler setup
87 ##################################
88 CC = cl
89 LINK = link
90 AR = lib
91 AS = nasm
92
93 CFLAGS = -nologo -Zm300 -G6 -W3 -c -D_MSC_VER=1200 -D__MSC__ -D_WIN32 -DWIN32 -DSTRICT
94 LFLAGS = -nologo /DLL /OPT:WIN98 /MACHINE:IX86 /NODEFAULTLIB
95 ARFLAGS = -nologo
96 ASFLAGS = -O2 -fwin32
97
98 !if "$(DEBUG)"== "1"
99 CFLAGS = $(CFLAGS) -Od -MTd -Zi -DDEBUG=1 -D_DEBUG -D_MT
100 LFLAGS = $(LFLAGS) -debugtype:both /DEBUG
101 ARFLAGS = $(ARFLAGS) -debugtype:both
102 ASFLAGS = $(ASFLAGS) -g -DDEBUG=1
103 !else
104 CFLAGS = $(CFLAGS) -Ox -MT -D_MT
105 LFLAGS = $(LFLAGS) -RELEASE
106 !endif
107
108 #################################
109 # OS commands
110 #################################
111 RM = @del
112 MV = mv
113
114 #################################
115 # sources
116 #################################
117 MAIN_SOURCES =\
118 main\api_arrayelt.c\
119 main\api_loopback.c\
120 main\api_noop.c\
121 main\api_validate.c\
122 main\accum.c\
123 main\arbparse.c\
124 main\arbprogram.c\
125 main\arbfragparse.c\
126 main\arbvertparse.c\
127 main\attrib.c\
128 main\blend.c\
129 main\bufferobj.c\
130 main\buffers.c\
131 main\clip.c\
132 main\colortab.c\
133 main\context.c\
134 main\convolve.c\
135 main\debug.c\
136 main\depth.c\
137 main\dispatch.c\
138 main\dlist.c\
139 main\drawpix.c\
140 main\enable.c\
141 main\enums.c\
142 main\eval.c\
143 main\extensions.c\
144 main\feedback.c\
145 main\fog.c\
146 main\get.c\
147 main\hash.c\
148 main\hint.c\
149 main\histogram.c\
150 main\image.c\
151 main\imports.c\
152 main\light.c\
153 main\lines.c\
154 main\matrix.c\
155 main\nvprogram.c\
156 main\nvfragparse.c\
157 main\nvvertexec.c\
158 main\nvvertparse.c\
159 main\occlude.c\
160 main\pixel.c\
161 main\points.c\
162 main\polygon.c\
163 main\program.c\
164 main\rastpos.c\
165 main\state.c\
166 main\stencil.c\
167 main\texcompress.c\
168 main\texformat.c\
169 main\teximage.c\
170 main\texobj.c\
171 main\texstate.c\
172 main\texstore.c\
173 main\texutil.c\
174 main\varray.c\
175 main\vtxfmt.c
176
177 GLAPI_SOURCES =\
178 glapi\glapi.c\
179 glapi\glthread.c
180
181 MATH_SOURCES =\
182 math\m_debug_clip.c\
183 math\m_debug_norm.c\
184 math\m_debug_xform.c\
185 math\m_eval.c\
186 math\m_matrix.c\
187 math\m_translate.c\
188 math\m_vector.c\
189 math\m_xform.c
190
191 ARRAY_CACHE_SOURCES =\
192 array_cache\ac_context.c\
193 array_cache\ac_import.c
194
195 SWRAST_SOURCES =\
196 swrast\s_aaline.c\
197 swrast\s_aatriangle.c\
198 swrast\s_accum.c\
199 swrast\s_alpha.c\
200 swrast\s_alphabuf.c\
201 swrast\s_bitmap.c\
202 swrast\s_blend.c\
203 swrast\s_buffers.c\
204 swrast\s_copypix.c\
205 swrast\s_context.c\
206 swrast\s_depth.c\
207 swrast\s_drawpix.c\
208 swrast\s_feedback.c\
209 swrast\s_fog.c\
210 swrast\s_imaging.c\
211 swrast\s_lines.c\
212 swrast\s_logic.c\
213 swrast\s_masking.c\
214 swrast\s_nvfragprog.c\
215 swrast\s_pixeltex.c\
216 swrast\s_points.c\
217 swrast\s_readpix.c\
218 swrast\s_span.c\
219 swrast\s_stencil.c\
220 swrast\s_texture.c\
221 swrast\s_texstore.c\
222 swrast\s_triangle.c\
223 swrast\s_zoom.c
224
225 SWRAST_SETUP_SOURCES =\
226 swrast_setup\ss_context.c\
227 swrast_setup\ss_triangle.c
228
229 TNL_SOURCES =\
230 tnl\t_array_api.c\
231 tnl\t_array_import.c\
232 tnl\t_context.c\
233 tnl\t_pipeline.c\
234 tnl\t_save_api.c\
235 tnl\t_save_loopback.c\
236 tnl\t_save_playback.c\
237 tnl\t_vb_fog.c\
238 tnl\t_vb_light.c\
239 tnl\t_vb_normals.c\
240 tnl\t_vb_points.c\
241 tnl\t_vb_program.c\
242 tnl\t_vb_render.c\
243 tnl\t_vb_texgen.c\
244 tnl\t_vb_texmat.c\
245 tnl\t_vb_vertex.c\
246 tnl\t_vertex.c\
247 tnl\t_vtx_api.c\
248 tnl\t_vtx_eval.c\
249 tnl\t_vtx_exec.c
250
251 DRIVER_SOURCES =\
252 drivers\common\driverfuncs.c\
253 drivers\glide\fxapi.c\
254 drivers\glide\fxdd.c\
255 drivers\glide\fxddspan.c\
256 drivers\glide\fxddtex.c\
257 drivers\glide\fxsetup.c\
258 drivers\glide\fxtexman.c\
259 drivers\glide\fxtris.c\
260 drivers\glide\fxvb.c\
261 drivers\glide\fxglidew.c\
262 drivers\glide\fxwgl.c\
263 drivers\glide\fxg.c
264
265 X86_SOURCES =\
266 x86\x86.c\
267 x86\glapi_x86.S\
268 x86\common_x86.c\
269 x86\common_x86_asm.S\
270 x86\x86_xform2.S\
271 x86\x86_xform3.S\
272 x86\x86_xform4.S\
273 x86\x86_cliptest.S
274
275 MMX_SOURCES =\
276 x86\mmx_blend.S
277
278 SSE_SOURCES =\
279 x86\sse.c\
280 x86\sse_xform2.S\
281 x86\sse_xform3.S\
282 x86\sse_xform4.S\
283 x86\sse_normal.S
284
285 K3D_SOURCES =\
286 x86\3dnow.c\
287 x86\3dnow_xform2.S\
288 x86\3dnow_xform3.S\
289 x86\3dnow_xform4.S\
290 x86\3dnow_normal.S
291
292 !if "$(HAVE_MMX)"=="1"
293 X86_SOURCES = $(X86_SOURCES) $(MMX_SOURCES)
294 HAVE_X86 = 1
295 !endif
296 !if "$(HAVE_SSE)"=="1"
297 X86_SOURCES = $(X86_SOURCES) $(SSE_SOURCES)
298 HAVE_X86 = 1
299 !endif
300 !if "$(HAVE_3DNOW)"=="1"
301 X86_SOURCES = $(X86_SOURCES) $(K3D_SOURCES)
302 HAVE_X86 = 1
303 !endif
304 !if "$(HAVE_X86)"=="1"
305 !else
306 X86_SOURCES =
307 !endif
308
309 EXPORTS = drivers\glide\fxopengl.def
310
311 MAIN_OBJS = $(MAIN_SOURCES:.c=.obj)
312 GLAPI_OBJS = $(GLAPI_SOURCES:.c=.obj)
313 MATH_OBJS = $(MATH_SOURCES:.c=.obj)
314 ARRAY_CACHE_OBJS = $(ARRAY_CACHE_SOURCES:.c=.obj)
315 SWRAST_OBJS = $(SWRAST_SOURCES:.c=.obj)
316 SWRAST_SETUP_OBJS = $(SWRAST_SETUP_SOURCES:.c=.obj)
317 TNL_OBJS = $(TNL_SOURCES:.c=.obj)
318 DRIVER_OBJS = $(DRIVER_SOURCES:.c=.obj)
319 X86_OBJS = $(X86_SOURCES:.c=.obj)
320 X86_OBJS = $(X86_OBJS:.S=.obj)
321
322 RES = drivers\glide\fx.res
323
324 CORE_LIBS =\
325 $(LIBDIR)\main.lib\
326 $(LIBDIR)\glapi.lib\
327 $(LIBDIR)\math.lib\
328 $(LIBDIR)\array_cache.lib\
329 $(LIBDIR)\swrast.lib\
330 $(LIBDIR)\swarst_setup.lib\
331 $(LIBDIR)\tnl.lib
332
333 !if "$(X86_SOURCES)"!=""
334 X86_LIB = $(LIBDIR)\x86.lib
335 !else
336 X86_LIB =
337 !endif
338
339 INCS = -I$(BUILDROOT)\include\
340 -I.\
341 -I.\drivers\glide\
342 -I.\main\
343 -I.\glapi\
344 -I$(GLIDE3SDK)\include
345
346 DEP_LIB = user32.lib gdi32.lib kernel32.lib
347
348 !if "$(DEBUG)" == "1"
349 STD_LIB = MSVCRTD.lib
350 !else
351 STD_LIB = MSVCRT.lib
352 !endif
353
354 #################################
355 # build rules
356 #################################
357 default:: all
358
359 all: $(X86_LIB) $(CORE_LIBS) $(LIBDIR)\$(GL_DLL)
360
361 $(LIBDIR)\$(GL_DLL): $(DRIVER_OBJS) $(CORE_LIBS) $(X86_LIB) $(RES)
362 $(LINK) -out:$@ -def:$(EXPORTS) $(LFLAGS) $(DRIVER_OBJS) $(CORE_LIBS) $(X86_LIB) $(DEP_LIB) $(STD_LIB) $(TEXUS2LIB) $(GLIDE3LIB) $(RES)
363
364 $(LIBDIR)\main.lib: $(MAIN_OBJS)
365 $(AR) -out:$@ $(ARFLAGS) $(MAIN_OBJS)
366
367 $(LIBDIR)\glapi.lib: $(GLAPI_OBJS)
368 $(AR) -out:$@ $(ARFLAGS) $(GLAPI_OBJS)
369
370 $(LIBDIR)\math.lib: $(MATH_OBJS)
371 $(AR) -out:$@ $(ARFLAGS) $(MATH_OBJS)
372
373 $(LIBDIR)\array_cache.lib: $(ARRAY_CACHE_OBJS)
374 $(AR) -out:$@ $(ARFLAGS) $(ARRAY_CACHE_OBJS)
375
376 $(LIBDIR)\swrast.lib: $(SWRAST_OBJS)
377 $(AR) -out:$@ $(ARFLAGS) $(SWRAST_OBJS)
378
379 $(LIBDIR)\swarst_setup.lib: $(SWRAST_SETUP_OBJS)
380 $(AR) -out:$@ $(ARFLAGS) $(SWRAST_SETUP_OBJS)
381
382 $(LIBDIR)\tnl.lib: $(TNL_OBJS)
383 $(AR) -out:$@ $(ARFLAGS) $(TNL_OBJS)
384
385 x86\matypes.h: x86\gen_matypes.exe
386 x86\gen_matypes.exe > $@
387
388 x86\gen_matypes.exe: x86\gen_matypes.obj
389 $(LINK) -out:$@ -nologo x86\gen_matypes.obj
390
391 $(LIBDIR)\x86.lib: x86\matypes.h $(X86_OBJS)
392 $(AR) -out:$@ $(ARFLAGS) $(X86_OBJS)
393
394 .c.obj:
395 $(CC) $(CFLAGS) $(FLAGS) $(INCS) $< /Fo$*.obj
396
397 .S.obj:
398 $(CC) $(CFLAGS) $(FLAGS) $(INCS) $< -D__WIN32__ -DNASM_ASSEMBLER -EP > $*.i
399 $(AS) $(ASFLAGS) $(INCS) $*.i -o $*.obj
400 $(RM) $*.i
401
402 .rc.res:
403 $(RC) -Fo$@ $(INCS) $(FLAGS) -D__WIN32__ $<
404
405 # [dBorca] Hack alert:
406 # glapi_x86.S needs some adjustments
407 # in order to generate correct entrypoints
408 x86\glapi_x86.obj: x86\glapi_x86.S
409 $(CC) $(CFLAGS) $(FLAGS) $(INCS) x86\glapi_x86.S -DSTDCALL_API -DNASM_ASSEMBLER -EP > $*.i
410 $(AS) $(ASFLAGS) $(INCS) $*.i -o $*.obj
411 $(RM) $*.i
412
413 #################################
414 # cleanup rules
415 #################################
416 realclean: clean clobber
417
418 clean::
419 $(RM) array_cache\*.obj
420 $(RM) glapi\*.obj
421 $(RM) main\*.obj
422 $(RM) math\*.obj
423 $(RM) swrast\*.obj
424 $(RM) swrast_setup\*.obj
425 $(RM) tnl\*.obj
426 $(RM) x86\*.obj
427 $(RM) drivers\common\*.obj
428 $(RM) drivers\glide\*.obj
429 $(RM) drivers\glide\*.res
430 $(RM) $(LIBDIR)\*.pdb
431 $(RM) *.pdb
432
433 clobber::
434 $(RM) $(LIBDIR)\*.lib
435 $(RM) $(LIBDIR)\*.exp
436 $(RM) $(LIBDIR)\*.dll