~gma500/+junk/gma500-natty

« back to all changes in this revision

Viewing changes to xpsb-glx/mesa/src/mesa/Makefile.mgw

  • Committer: Luca Forina
  • Date: 2011-02-14 10:01:54 UTC
  • Revision ID: luca.forina@gmail.com-20110214100154-ai9gynuqb1dna2ea
new commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Mesa 3-D graphics library
 
2
# Version:  7.0
 
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.4 for Mesa
 
24
#
 
25
#  Copyright (C) 2002 - Daniel Borca
 
26
#  Email : dborca@users.sourceforge.net
 
27
#  Web   : http://www.geocities.com/dborca
 
28
 
 
29
# MinGW core-gl makefile updated for Mesa 7.0
 
30
#
 
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!
 
38
 
 
39
 
 
40
#
 
41
#  Available options:
 
42
#
 
43
#    Environment variables:
 
44
#       CFLAGS
 
45
#
 
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.
 
52
#                       default = no
 
53
#       ICD=1           build the installable client driver interface
 
54
#                       (windows opengl driver interface)
 
55
#                       default = no
 
56
#       X86=1           optimize for x86 (if possible, use MMX, SSE, 3DNow).
 
57
#                       default = no
 
58
#
 
59
#    Targets:
 
60
#       all:            build GL
 
61
#       clean:          remove object files
 
62
#
 
63
 
 
64
 
 
65
.PHONY: all clean
 
66
.INTERMEDIATE: x86/gen_matypes.exe
 
67
.SUFFIXES: .rc .res
 
68
 
 
69
# Set this to the prefix of your build tools, i.e. mingw32-
 
70
TOOLS_PREFIX = mingw32-
 
71
 
 
72
ifeq ($(ICD),1)
 
73
  LIB_NAME = mesa32
 
74
else
 
75
  LIB_NAME = opengl32
 
76
endif
 
77
 
 
78
DLL_EXT = .dll
 
79
IMP_EXT = .a
 
80
LIB_PRE = lib
 
81
STRIP = -s
 
82
 
 
83
AR = ar
 
84
ARFLAGS = crus
 
85
DLLTOOL = dlltool
 
86
 
 
87
TOP = ../..
 
88
GLIDE ?= $(TOP)/glide3
 
89
LIBDIR = $(TOP)/lib
 
90
 
 
91
GL_DLL = $(LIB_NAME)$(DLL_EXT)
 
92
GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
 
93
 
 
94
MESA_LIB = libmesa.a
 
95
CC = $(TOOLS_PREFIX)gcc
 
96
 
 
97
LDLIBS = -lgdi32 -luser32 -liberty
 
98
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
 
99
 
 
100
CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN
 
101
CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1
 
102
 
 
103
ifeq ($(FX),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
 
108
else
 
109
  ifeq ($(ICD),1)
 
110
    CFLAGS += -DUSE_MGL_NAMESPACE
 
111
    GL_DEF = drivers/windows/icd/mesa.def
 
112
  else    
 
113
    GL_DEF = $(LIB_NAME).def
 
114
  endif
 
115
endif
 
116
 
 
117
 
 
118
 
 
119
UNLINK = del $(subst /,\,$(1))
 
120
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
 
121
UNLINK = $(RM) $(1)
 
122
endif
 
123
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
 
124
UNLINK = $(RM) $(1)
 
125
endif
 
126
 
 
127
include sources
 
128
 
 
129
CFLAGS += $(INCLUDE_DIRS) 
 
130
 
 
131
ifeq ($(X86),1)
 
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)
 
137
else
 
138
X86_SOURCES =
 
139
endif
 
140
 
 
141
ifeq ($(FX),1)
 
142
DRIVER_SOURCES = \
 
143
        $(GLIDE_DRIVER_SOURCES) \
 
144
        drivers/windows/fx/fxwgl.c
 
145
else
 
146
ifeq ($(ICD),1)
 
147
DRIVER_SOURCES = \
 
148
        drivers/windows/gdi/wmesa.c \
 
149
        drivers/windows/icd/icd.c
 
150
else
 
151
DRIVER_SOURCES = \
 
152
        drivers/windows/gdi/wmesa.c \
 
153
        drivers/windows/gdi/wgl.c
 
154
endif
 
155
endif
 
156
 
 
157
SOURCES = $(MESA_SOURCES) $(GLAPI_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
 
158
 
 
159
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
 
160
 
 
161
X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
 
162
 
 
163
RESOURCE = $(GL_RES:.rc=.res)
 
164
 
 
165
.c.o:
 
166
        $(CC) -o $@ $(CFLAGS) -c $<
 
167
.s.o:
 
168
        $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
 
169
 
 
170
.rc.res:
 
171
        windres -o $@ -Irc -Ocoff $<
 
172
 
 
173
 
 
174
all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
 
175
 
 
176
$(LIBDIR):
 
177
        mkdir -p $(LIBDIR)
 
178
 
 
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)
 
183
 
 
184
 
 
185
$(X86_OBJECTS): x86/matypes.h
 
186
 
 
187
x86/matypes.h: x86/gen_matypes.exe
 
188
        $(subst /,\,$< > $@)
 
189
 
 
190
x86/gen_matypes.exe: x86/gen_matypes.c
 
191
        $(CC) -o $@ $(CFLAGS) -s $<
 
192
 
 
193
# [dBorca]
 
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)
 
199
ifeq (1,1)
 
200
x86/glapi_x86.o: x86/glapi_x86.S
 
201
        $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
 
202
else
 
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 $<
 
207
endif
 
208
 
 
209
# [dBorca]
 
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 $<
 
213
 
 
214
clean:
 
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)