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.4 for Mesa
25 # Copyright (C) 2002 - Daniel Borca
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 # ICD=1 build the installable client driver interface
44 # (windows opengl driver interface)
46 # X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
51 # clean: remove object files
57 .INTERMEDIATE: x86/gen_matypes.exe
61 GLIDE ?= $(TOP)/glide3
68 GL_IMP = libopengl32.a
74 CFLAGS += -DBUILD_GL32 -D_OPENGL32_
75 CFLAGS += $(INCLUDE_DIRS)
76 CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
78 CFLAGS += -I$(GLIDE)/include -DFX
79 LDLIBS += -L$(GLIDE)/lib -lglide3x
80 GL_DEF = drivers/windows/fx/fxopengl.def
81 GL_RES = drivers/windows/fx/fx.rc
84 CFLAGS += -DUSE_MGL_NAMESPACE
85 GL_DEF = drivers/windows/icd/mesa.def
87 GL_DEF = drivers/windows/gdi/mesa.def
94 ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
95 UNLINK = del $(subst /,\,$(1))
103 CFLAGS += -DUSE_X86_ASM
104 CFLAGS += -DUSE_MMX_ASM
105 CFLAGS += -DUSE_SSE_ASM
106 CFLAGS += -DUSE_3DNOW_ASM
107 X86_SOURCES += $(X86_API)
114 $(GLIDE_DRIVER_SOURCES) \
115 drivers/windows/fx/fxwgl.c
119 drivers/windows/gdi/wmesa.c \
120 drivers/windows/icd/icd.c
123 drivers/windows/gdi/wmesa.c \
124 drivers/windows/gdi/wgl.c
128 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES)
130 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
132 X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
134 RESOURCE = $(GL_RES:.rc=.res)
137 $(CC) -o $@ $(CFLAGS) -c $<
139 $(CC) -o $@ $(CFLAGS) -c $<
141 $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
143 windres -o $@ -Irc -Ocoff $<
145 all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
147 $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
148 dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) --target i386-mingw32 --def $(GL_DEF) $^ $(LDLIBS)
150 $(X86_OBJECTS): x86/matypes.h
152 x86/matypes.h: x86/gen_matypes.exe
155 x86/gen_matypes.exe: x86/gen_matypes.c
156 $(CC) -o $@ $(CFLAGS) -s $<
159 # glapi_x86.S needs some adjustments
160 # in order to generate correct entrypoints
161 # Trick: change the following condition to
162 # be always false if you need C entrypoints
163 # with USE_X86_ASM (useful for trace/debug)
165 x86/glapi_x86.o: x86/glapi_x86.S
166 $(CC) -o $@ $(CFLAGS) -U__WIN32__ -DSTDCALL_API -c $<
168 main/dispatch.o: main/dispatch.c
169 $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
170 glapi/glapi.o: glapi/glapi.c
171 $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
175 # if we want codegen, we have to stdcall
176 tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
177 $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
180 -$(call UNLINK,array_cache/*.o)
181 -$(call UNLINK,glapi/*.o)
182 -$(call UNLINK,main/*.o)
183 -$(call UNLINK,math/*.o)
184 -$(call UNLINK,shader/*.o)
185 -$(call UNLINK,sparc/*.o)
186 -$(call UNLINK,ppc/*.o)
187 -$(call UNLINK,swrast/*.o)
188 -$(call UNLINK,swrast_setup/*.o)
189 -$(call UNLINK,tnl/*.o)
190 -$(call UNLINK,x86/*.o)
191 -$(call UNLINK,drivers/common/*.o)
192 -$(call UNLINK,drivers/glide/*.o)
193 -$(call UNLINK,drivers/windows/fx/*.o)
194 -$(call UNLINK,drivers/windows/fx/*.res)
195 -$(call UNLINK,drivers/windows/gdi/*.o)
196 -$(call UNLINK,drivers/windows/icd/*.o)