1 # Mesa 3-D graphics library
4 # Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
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:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
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.
23 # MinGW core makefile v1.0 for Mesa
25 # Copyright (C) 2002 - Borca Daniel
26 # Email : dborca@users.sourceforge.net
27 # Web : http://www.geocities.com/dborca
33 # Environment variables:
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.
43 # HAVE_X86=1 optimize for i386.
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.
49 # HAVE_SSE=1 (see HAVE_MMX)
51 # HAVE_3DNOW=1 (see HAVE_MMX)
56 # clean: remove object files
62 .INTERMEDIATE: x86/gen_matypes.exe
66 GLIDE ?= $(TOP)/glide3
69 GL_IMP = libopengl32.a
74 CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_MSC_VER
75 CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
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
83 GL_DEF = drivers/windows/gdi/mesa.def
89 ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
90 UNLINK = del $(subst /,\,$(1))
102 main/arbfragparse.c \
103 main/arbvertparse.c \
159 math/m_debug_clip.c \
160 math/m_debug_norm.c \
161 math/m_debug_xform.c \
168 ARRAY_CACHE_SOURCES = \
169 array_cache/ac_context.c \
170 array_cache/ac_import.c
174 swrast/s_aatriangle.c \
177 swrast/s_alphabuf.c \
185 swrast/s_feedback.c \
191 swrast/s_nvfragprog.c \
192 swrast/s_pixeltex.c \
198 swrast/s_texstore.c \
199 swrast/s_triangle.c \
202 SWRAST_SETUP_SOURCES = \
203 swrast_setup/ss_context.c \
204 swrast_setup/ss_triangle.c \
209 tnl/t_array_import.c \
235 x86/common_x86_asm.S \
262 $(ARRAY_CACHE_SOURCES) \
264 $(SWRAST_SETUP_SOURCES) \
268 X86_SOURCES += $(MMX_SOURCES)
269 CFLAGS += -DUSE_MMX_ASM
273 X86_SOURCES += $(SSE_SOURCES)
274 CFLAGS += -DUSE_SSE_ASM
277 ifeq ($(HAVE_3DNOW),1)
278 X86_SOURCES += $(K3D_SOURCES)
279 CFLAGS += -DUSE_3DNOW_ASM
283 CFLAGS += -DUSE_X86_ASM
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
303 drivers/windows/gdi/wmesa.c \
304 drivers/windows/gdi/wgl.c
307 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
309 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
311 X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
313 RESOURCE = $(GL_RES:.rc=.res)
316 $(CC) -o $@ $(CFLAGS) -c $<
318 $(CC) -o $@ $(CFLAGS) -c $<
320 $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
322 windres -o $@ -Irc -Ocoff $<
324 all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
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)
329 $(X86_OBJECTS): x86/matypes.h
331 x86/matypes.h: x86/gen_matypes.exe
334 x86/gen_matypes.exe: x86/gen_matypes.c
335 $(CC) -o $@ $(CFLAGS) -s $<
337 # [dBorca] Hack alert:
338 # glapi_x86.S needs some adjustments
339 # in order to generate correct entrypoints
340 x86/glapi_x86.o: x86/glapi_x86.S
341 $(CC) -o $@ $(CFLAGS) -U__WIN32__ -DSTDCALL_API -c $<
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)