added program.c plus minor fixes
[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
64 TOP = ../..
65 GLIDE ?= $(TOP)/glide3
66 LIBDIR = $(TOP)/lib
67 GL_DLL = opengl32.dll
68 GL_IMP = libopengl32.a
69
70 LDLIBS = -lgdi32
71
72 CC = mingw32-gcc
73 CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_MSC_VER
74 CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
75 ifeq ($(FX),1)
76 CFLAGS += -DH3
77 CFLAGS += -I$(GLIDE)/include -DFX
78 LDLIBS += -L$(GLIDE)/lib -lglide3
79 GL_DEF = drivers/glide/fxopengl.def
80 else
81 GL_DEF = drivers/windows/gdi/mesa.def
82 endif
83
84 AR = ar
85 ARFLAGS = rus
86
87 ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
88 UNLINK = del $(subst /,\,$(1))
89 else
90 UNLINK = $(RM) $(1)
91 endif
92
93 MAIN_SOURCES = \
94 main/api_arrayelt.c \
95 main/api_loopback.c \
96 main/api_noop.c \
97 main/api_validate.c \
98 main/accum.c \
99 main/arbprogram.c \
100 main/arbfragparse.c \
101 main/arbvertparse.c \
102 main/attrib.c \
103 main/blend.c \
104 main/bufferobj.c \
105 main/buffers.c \
106 main/clip.c \
107 main/colortab.c \
108 main/context.c \
109 main/convolve.c \
110 main/debug.c \
111 main/depth.c \
112 main/dispatch.c \
113 main/dlist.c \
114 main/drawpix.c \
115 main/enable.c \
116 main/enums.c \
117 main/eval.c \
118 main/extensions.c \
119 main/feedback.c \
120 main/fog.c \
121 main/get.c \
122 main/hash.c \
123 main/hint.c \
124 main/histogram.c \
125 main/image.c \
126 main/imports.c \
127 main/light.c \
128 main/lines.c \
129 main/matrix.c \
130 main/nvprogram.c \
131 main/nvfragparse.c \
132 main/nvvertexec.c \
133 main/nvvertparse.c \
134 main/occlude.c \
135 main/pixel.c \
136 main/points.c \
137 main/polygon.c \
138 main/rastpos.c \
139 main/state.c \
140 main/stencil.c \
141 main/texcompress.c \
142 main/texformat.c \
143 main/teximage.c \
144 main/texobj.c \
145 main/texstate.c \
146 main/texstore.c \
147 main/texutil.c \
148 main/varray.c \
149 main/vtxfmt.c
150
151 GLAPI_SOURCES = \
152 glapi/glapi.c \
153 glapi/glthread.c
154
155 MATH_SOURCES = \
156 math/m_debug_clip.c \
157 math/m_debug_norm.c \
158 math/m_debug_xform.c \
159 math/m_eval.c \
160 math/m_matrix.c \
161 math/m_translate.c \
162 math/m_vector.c \
163 math/m_xform.c
164
165 ARRAY_CACHE_SOURCES = \
166 array_cache/ac_context.c \
167 array_cache/ac_import.c
168
169 SWRAST_SOURCES = \
170 swrast/s_aaline.c \
171 swrast/s_aatriangle.c \
172 swrast/s_accum.c \
173 swrast/s_alpha.c \
174 swrast/s_alphabuf.c \
175 swrast/s_bitmap.c \
176 swrast/s_blend.c \
177 swrast/s_buffers.c \
178 swrast/s_copypix.c \
179 swrast/s_context.c \
180 swrast/s_depth.c \
181 swrast/s_drawpix.c \
182 swrast/s_feedback.c \
183 swrast/s_fog.c \
184 swrast/s_imaging.c \
185 swrast/s_lines.c \
186 swrast/s_logic.c \
187 swrast/s_masking.c \
188 swrast/s_nvfragprog.c \
189 swrast/s_pixeltex.c \
190 swrast/s_points.c \
191 swrast/s_readpix.c \
192 swrast/s_span.c \
193 swrast/s_stencil.c \
194 swrast/s_texture.c \
195 swrast/s_texstore.c \
196 swrast/s_triangle.c \
197 swrast/s_zoom.c
198
199 SWRAST_SETUP_SOURCES = \
200 swrast_setup/ss_context.c \
201 swrast_setup/ss_triangle.c \
202 swrast_setup/ss_vb.c
203
204 TNL_SOURCES = \
205 tnl/t_array_api.c \
206 tnl/t_array_import.c \
207 tnl/t_context.c \
208 tnl/t_eval_api.c \
209 tnl/t_imm_alloc.c \
210 tnl/t_imm_api.c \
211 tnl/t_imm_debug.c \
212 tnl/t_imm_dlist.c \
213 tnl/t_imm_elt.c \
214 tnl/t_imm_eval.c \
215 tnl/t_imm_exec.c \
216 tnl/t_imm_fixup.c \
217 tnl/t_pipeline.c \
218 tnl/t_vb_fog.c \
219 tnl/t_vb_light.c \
220 tnl/t_vb_normals.c \
221 tnl/t_vb_points.c \
222 tnl/t_vb_program.c \
223 tnl/t_vb_render.c \
224 tnl/t_vb_texgen.c \
225 tnl/t_vb_texmat.c \
226 tnl/t_vb_vertex.c
227
228 X86_SOURCES = \
229 x86/x86.c \
230 x86/glapi_x86.S \
231 x86/common_x86.c \
232 x86/common_x86_asm.S \
233 x86/x86_xform2.S \
234 x86/x86_xform3.S \
235 x86/x86_xform4.S \
236 x86/x86_cliptest.S
237
238 MMX_SOURCES = \
239 x86/mmx_blend.S
240
241 SSE_SOURCES = \
242 x86/sse.c \
243 x86/sse_xform2.S \
244 x86/sse_xform3.S \
245 x86/sse_xform4.S \
246 x86/sse_normal.S
247
248 K3D_SOURCES = \
249 x86/3dnow.c \
250 x86/3dnow_xform2.S \
251 x86/3dnow_xform3.S \
252 x86/3dnow_xform4.S \
253 x86/3dnow_normal.S
254
255 CORE_SOURCES = \
256 $(MAIN_SOURCES) \
257 $(GLAPI_SOURCES) \
258 $(MATH_SOURCES) \
259 $(ARRAY_CACHE_SOURCES) \
260 $(SWRAST_SOURCES) \
261 $(SWRAST_SETUP_SOURCES) \
262 $(TNL_SOURCES)
263
264 ifeq ($(HAVE_MMX),1)
265 X86_SOURCES += $(MMX_SOURCES)
266 CFLAGS += -DUSE_MMX_ASM
267 HAVE_X86 = 1
268 endif
269 ifeq ($(HAVE_SSE),1)
270 X86_SOURCES += $(SSE_SOURCES)
271 CFLAGS += -DUSE_SSE_ASM
272 HAVE_X86 = 1
273 endif
274 ifeq ($(HAVE_3DNOW),1)
275 X86_SOURCES += $(K3D_SOURCES)
276 CFLAGS += -DUSE_3DNOW_ASM
277 HAVE_X86 = 1
278 endif
279 ifeq ($(HAVE_X86),1)
280 CFLAGS += -DUSE_X86_ASM
281 else
282 X86_SOURCES =
283 endif
284
285 ifeq ($(FX),1)
286 DRIVER_SOURCES = \
287 drivers/glide/fxapi.c \
288 drivers/glide/fxdd.c \
289 drivers/glide/fxddspan.c \
290 drivers/glide/fxddtex.c \
291 drivers/glide/fxsetup.c \
292 drivers/glide/fxtexman.c \
293 drivers/glide/fxtris.c \
294 drivers/glide/fxvb.c \
295 drivers/glide/fxglidew.c \
296 drivers/glide/fxwgl.c
297 else
298 DRIVER_SOURCES = \
299 drivers/windows/gdi/wmesa.c \
300 drivers/windows/gdi/wgl.c
301 endif
302
303 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
304
305 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
306
307 X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
308
309 .c.o:
310 $(CC) -o $@ $(CFLAGS) -c $<
311 .S.o:
312 $(CC) -o $@ $(CFLAGS) -c $<
313 .s.o:
314 $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
315
316 all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
317
318 $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS)
319 dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) --target i386-mingw32 --def $(GL_DEF) $^ $(LDLIBS)
320
321 $(X86_OBJECTS): x86/matypes.h
322
323 x86/matypes.h: x86/gen_matypes.exe
324 $(subst /,\,$< > $@)
325
326 x86/gen_matypes.exe: x86/gen_matypes.c
327 $(CC) -o $@ $(CFLAGS) -s $<
328
329 clean:
330 -$(call UNLINK,array_cache/*.o)
331 -$(call UNLINK,glapi/*.o)
332 -$(call UNLINK,main/*.o)
333 -$(call UNLINK,math/*.o)
334 -$(call UNLINK,swrast/*.o)
335 -$(call UNLINK,swrast_setup/*.o)
336 -$(call UNLINK,tnl/*.o)
337 -$(call UNLINK,x86/*.o)
338 -$(call UNLINK,drivers/windows/gdi/*.o)
339 -$(call UNLINK,drivers/glide/*.o)