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
29
# MinGW core-gl makefile updated for Mesa 7.0
31
# updated : by Heromyth, on 2007-7-21
32
# Email : zxpmyth@yahoo.com.cn
33
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
34
# The others havn't been tested yet.
35
# 2) The generated DLLs are *not* compatible with the ones built
36
# with the other compilers like VC8, especially for GLUT.
37
# 3) Although more tests are needed, it can be used individually!
43
# Environment variables:
46
# GLIDE path to Glide3 SDK; used with FX.
47
# default = $(TOP)/glide3
48
# FX=1 build for 3dfx Glide3. Note that this disables
49
# compilation of most WMesa code and requires fxMesa.
50
# As a consequence, you'll need the Win32 Glide3
51
# library to build any application.
53
# ICD=1 build the installable client driver interface
54
# (windows opengl driver interface)
56
# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
61
# clean: remove object files
66
.INTERMEDIATE: x86/gen_matypes.exe
69
# Set this to the prefix of your build tools, i.e. mingw32-
70
TOOLS_PREFIX = mingw32-
88
GLIDE ?= $(TOP)/glide3
91
GL_DLL = $(LIB_NAME)$(DLL_EXT)
92
GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
95
CC = $(TOOLS_PREFIX)gcc
97
LDLIBS = -lgdi32 -luser32 -liberty
98
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
100
CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN
101
CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1
104
CFLAGS += -I$(GLIDE)/include -DFX
105
LDLIBS += -L$(GLIDE)/lib -lglide3x
106
GL_DEF = drivers/windows/fx/fxopengl.def
107
GL_RES = drivers/windows/fx/fx.rc
110
CFLAGS += -DUSE_MGL_NAMESPACE
111
GL_DEF = drivers/windows/icd/mesa.def
113
GL_DEF = $(LIB_NAME).def
119
UNLINK = del $(subst /,\,$(1))
120
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
123
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
129
CFLAGS += $(INCLUDE_DIRS)
132
CFLAGS += -DUSE_X86_ASM
133
CFLAGS += -DUSE_MMX_ASM
134
CFLAGS += -DUSE_SSE_ASM
135
CFLAGS += -DUSE_3DNOW_ASM
136
X86_SOURCES += $(X86_API)
143
$(GLIDE_DRIVER_SOURCES) \
144
drivers/windows/fx/fxwgl.c
148
drivers/windows/gdi/wmesa.c \
149
drivers/windows/icd/icd.c
152
drivers/windows/gdi/wmesa.c \
153
drivers/windows/gdi/wgl.c
157
SOURCES = $(MESA_SOURCES) $(GLAPI_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
159
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
161
X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
163
RESOURCE = $(GL_RES:.rc=.res)
166
$(CC) -o $@ $(CFLAGS) -c $<
168
$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
171
windres -o $@ -Irc -Ocoff $<
174
all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
179
$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
180
$(CC) $(LDFLAGS) -o $(LIBDIR)/$(GL_DLL) $^ $(LDLIBS)
181
$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GL_DEF) $^
182
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GL_IMP) --def $(LIBDIR)/$(GL_DEF)
185
$(X86_OBJECTS): x86/matypes.h
187
x86/matypes.h: x86/gen_matypes.exe
190
x86/gen_matypes.exe: x86/gen_matypes.c
191
$(CC) -o $@ $(CFLAGS) -s $<
194
# glapi_x86.S needs some adjustments
195
# in order to generate correct entrypoints
196
# Trick: change the following condition to
197
# be always false if you need C entrypoints
198
# with USE_X86_ASM (useful for trace/debug)
200
x86/glapi_x86.o: x86/glapi_x86.S
201
$(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
203
main/dispatch.o: main/dispatch.c
204
$(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
205
glapi/glapi.o: glapi/glapi.c
206
$(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
210
# if we want codegen, we have to stdcall
211
tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
212
$(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
215
-$(call UNLINK,glapi/*.o)
216
-$(call UNLINK,main/*.o)
217
-$(call UNLINK,math/*.o)
218
-$(call UNLINK,vbo/*.o)
219
-$(call UNLINK,shader/*.o)
220
-$(call UNLINK,shader/slang/*.o)
221
-$(call UNLINK,shader/grammar/*.o)
222
-$(call UNLINK,sparc/*.o)
223
-$(call UNLINK,ppc/*.o)
224
-$(call UNLINK,swrast/*.o)
225
-$(call UNLINK,swrast_setup/*.o)
226
-$(call UNLINK,tnl/*.o)
227
-$(call UNLINK,x86/*.o)
228
-$(call UNLINK,x86/rtasm/*.o)
229
-$(call UNLINK,x86-64/*.o)
230
-$(call UNLINK,drivers/common/*.o)
231
-$(call UNLINK,drivers/glide/*.o)
232
-$(call UNLINK,drivers/windows/fx/*.o)
233
-$(call UNLINK,drivers/windows/fx/*.res)
234
-$(call UNLINK,drivers/windows/gdi/*.o)
235
-$(call UNLINK,drivers/windows/icd/*.o)