Fix a number of MINGW32 issues
[mesa.git] / src / glut / glx / 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.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-glut 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
66 .PHONY: all clean
67 .INTERMEDIATE: x86/gen_matypes.exe
68 .SUFFIXES: .rc .res
69
70 # Set this to the prefix of your build tools, i.e. mingw32-
71 TOOLS_PREFIX = mingw32-
72
73 TOP = ../../..
74
75 LIBDIR = $(TOP)/lib
76
77 GLUT_DLL = glut32.dll
78 GLUT_IMP = libglut32.a
79 GLUT_DEF = glut.def
80
81 include $(TOP)/configs/config.mgw
82 GLUT_USING_STDCALL ?= 1
83
84
85
86 LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32
87 LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLUT_IMP) -Wl,--output-def=$(LIBDIR)/$(GLUT_DEF)
88
89 CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
90
91 ifeq ($(GL_USING_STDCALL),0)
92 CFLAGS += -DGL_NO_STDCALL
93 endif
94
95 ifeq ($(GLUT_USING_STDCALL),1)
96 CFLAGS += -D_STDCALL_SUPPORTED
97 LDFLAGS += -Wl,--add-stdcall-alias
98 else
99 CFLAGS += -DGLUT_NO_STDCALL
100 endif
101
102 CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include
103
104 CC = gcc
105 CXX = g++
106 CXXFLAGS = $(CFLAGS)
107
108 AR = ar
109 ARFLAGS = crus
110
111 UNLINK = del $(subst /,\,$(1))
112 ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
113 UNLINK = $(RM) $(1)
114 endif
115 ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
116 UNLINK = $(RM) $(1)
117 endif
118
119 HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h
120
121 SRCS = \
122 glut_bitmap.c \
123 glut_bwidth.c \
124 glut_cindex.c \
125 glut_cmap.c \
126 glut_cursor.c \
127 glut_dials.c \
128 glut_dstr.c \
129 glut_event.c \
130 glut_ext.c \
131 glut_fbc.c \
132 glut_fullscrn.c \
133 glut_gamemode.c \
134 glut_get.c \
135 glut_init.c \
136 glut_input.c \
137 glut_joy.c \
138 glut_key.c \
139 glut_keyctrl.c \
140 glut_keyup.c \
141 glut_mesa.c \
142 glut_modifier.c \
143 glut_overlay.c \
144 glut_shapes.c \
145 glut_space.c \
146 glut_stroke.c \
147 glut_swap.c \
148 glut_swidth.c \
149 glut_tablet.c \
150 glut_teapot.c \
151 glut_util.c \
152 glut_vidresize.c \
153 glut_warp.c \
154 glut_win.c \
155 glut_winmisc.c \
156 win32_glx.c \
157 win32_menu.c \
158 win32_util.c \
159 win32_winproc.c \
160 win32_x11.c
161
162
163 SRCSSEMIGENS = \
164 glut_8x13.c \
165 glut_9x15.c \
166 glut_hel10.c \
167 glut_hel12.c \
168 glut_hel18.c \
169 glut_mroman.c \
170 glut_roman.c \
171 glut_tr10.c \
172 glut_tr24.c
173
174
175
176 SOURCES = $(SRCS) $(SRCSSEMIGENS)
177
178 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
179
180 .c.o:
181 $(CC) -o $@ $(CFLAGS) -c $<
182 .cc.o:
183 $(CXX) -o $@ $(CXXFLAGS) -c $<
184
185
186 all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP)
187
188 $(LIBDIR):
189 mkdir -p $(LIBDIR)
190
191 $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
192 $(CXX) -shared -fPIC -o $(LIBDIR)/$(GLUT_DLL) $(LDFLAGS) \
193 $^ $(LDLIBS)
194
195
196
197 clean:
198 -$(call UNLINK,*.o)