added _NEW_PROGRAM to check_state flags for pipeline stages (fixes vparray demo bug)
[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.2 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 include sources
96
97 X86_SOURCES = \
98 x86/x86.c \
99 x86/glapi_x86.S \
100 x86/common_x86.c \
101 x86/common_x86_asm.S \
102 x86/x86_xform2.S \
103 x86/x86_xform3.S \
104 x86/x86_xform4.S \
105 x86/x86_cliptest.S
106
107 MMX_SOURCES = \
108 x86/mmx_blend.S
109
110 SSE_SOURCES = \
111 x86/sse.c \
112 x86/sse_xform2.S \
113 x86/sse_xform3.S \
114 x86/sse_xform4.S \
115 x86/sse_normal.S
116
117 K3D_SOURCES = \
118 x86/3dnow.c \
119 x86/3dnow_xform2.S \
120 x86/3dnow_xform3.S \
121 x86/3dnow_xform4.S \
122 x86/3dnow_normal.S
123
124 CORE_SOURCES = \
125 $(MAIN_SOURCES) \
126 $(GLAPI_SOURCES) \
127 $(MATH_SOURCES) \
128 $(ARRAY_CACHE_SOURCES) \
129 $(TNL_SOURCES) \
130 $(SWRAST_SOURCES) \
131 $(SWRAST_SETUP_SOURCES)
132
133 ifeq ($(HAVE_MMX),1)
134 X86_SOURCES += $(MMX_SOURCES)
135 CFLAGS += -DUSE_MMX_ASM
136 HAVE_X86 = 1
137 endif
138 ifeq ($(HAVE_SSE),1)
139 X86_SOURCES += $(SSE_SOURCES)
140 CFLAGS += -DUSE_SSE_ASM
141 HAVE_X86 = 1
142 endif
143 ifeq ($(HAVE_3DNOW),1)
144 X86_SOURCES += $(K3D_SOURCES)
145 CFLAGS += -DUSE_3DNOW_ASM
146 HAVE_X86 = 1
147 endif
148 ifeq ($(HAVE_X86),1)
149 CFLAGS += -DUSE_X86_ASM
150 else
151 X86_SOURCES =
152 endif
153
154 ifeq ($(FX),1)
155 DRIVER_SOURCES = \
156 drivers/glide/fxapi.c \
157 drivers/glide/fxdd.c \
158 drivers/glide/fxddspan.c \
159 drivers/glide/fxddtex.c \
160 drivers/glide/fxsetup.c \
161 drivers/glide/fxtexman.c \
162 drivers/glide/fxtris.c \
163 drivers/glide/fxvb.c \
164 drivers/glide/fxglidew.c \
165 drivers/glide/fxg.c \
166 drivers/glide/fxwgl.c
167 else
168 DRIVER_SOURCES = \
169 drivers/windows/gdi/wmesa.c \
170 drivers/windows/gdi/wgl.c
171 endif
172
173 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES)
174
175 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
176
177 X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
178
179 RESOURCE = $(GL_RES:.rc=.res)
180
181 .c.o:
182 $(CC) -o $@ $(CFLAGS) -c $<
183 .S.o:
184 $(CC) -o $@ $(CFLAGS) -c $<
185 .s.o:
186 $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
187 .rc.res:
188 windres -o $@ -Irc -Ocoff $<
189
190 all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
191
192 $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
193 dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) --target i386-mingw32 --def $(GL_DEF) $^ $(LDLIBS)
194
195 $(X86_OBJECTS): x86/matypes.h
196
197 x86/matypes.h: x86/gen_matypes.exe
198 $(subst /,\,$< > $@)
199
200 x86/gen_matypes.exe: x86/gen_matypes.c
201 $(CC) -o $@ $(CFLAGS) -s $<
202
203 # [dBorca] Hack alert:
204 # glapi_x86.S needs some adjustments
205 # in order to generate correct entrypoints
206 x86/glapi_x86.o: x86/glapi_x86.S
207 $(CC) -o $@ $(CFLAGS) -U__WIN32__ -DSTDCALL_API -c $<
208 #main/dispatch.o: main/dispatch.c
209 # $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
210
211 clean:
212 -$(call UNLINK,array_cache/*.o)
213 -$(call UNLINK,glapi/*.o)
214 -$(call UNLINK,main/*.o)
215 -$(call UNLINK,math/*.o)
216 -$(call UNLINK,swrast/*.o)
217 -$(call UNLINK,swrast_setup/*.o)
218 -$(call UNLINK,tnl/*.o)
219 -$(call UNLINK,x86/*.o)
220 -$(call UNLINK,drivers/common/*.o)
221 -$(call UNLINK,drivers/windows/gdi/*.o)
222 -$(call UNLINK,drivers/glide/*.o)
223 -$(call UNLINK,drivers/glide/*.res)