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-
71TOOLS_PREFIX = mingw32-
72
73TOP = ../../..
74
75LIBDIR = $(TOP)/lib
76
77LIB_NAME = glut32
78
79DLL_EXT = .dll
80IMP_EXT = .a
81LIB_PRE = lib
82STRIP = -s
83
84AR = ar
85ARFLAGS = crus
86DLLTOOL = dlltool
87
88GLUT_DLL = $(LIB_NAME)$(DLL_EXT)
89GLUT_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
90GLUT_DEF = $(LIB_NAME).def
91
92LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32 
93LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
94
95CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
96CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include 
97
98CC = $(TOOLS_PREFIX)gcc
99CXX = $(TOOLS_PREFIX)g++
100CXXFLAGS = $(CFLAGS)
101
102AR = ar
103ARFLAGS = crus
104
105UNLINK = del $(subst /,\,$(1))
106ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
107UNLINK = $(RM) $(1)
108endif
109ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
110UNLINK = $(RM) $(1)
111endif
112
113HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h
114
115SRCS = \
116	glut_bitmap.c \
117	glut_bwidth.c \
118	glut_cindex.c \
119	glut_cmap.c \
120	glut_cursor.c \
121	glut_dials.c \
122	glut_dstr.c \
123	glut_event.c \
124	glut_ext.c \
125	glut_fcb.c \
126	glut_fullscrn.c \
127	glut_gamemode.c \
128	glut_get.c \
129	glut_init.c \
130	glut_input.c \
131	glut_joy.c \
132	glut_key.c \
133	glut_keyctrl.c \
134	glut_keyup.c \
135	glut_mesa.c \
136	glut_modifier.c \
137	glut_overlay.c \
138	glut_shapes.c \
139	glut_space.c \
140	glut_stroke.c \
141	glut_swap.c \
142	glut_swidth.c \
143	glut_tablet.c \
144	glut_teapot.c \
145	glut_util.c \
146	glut_vidresize.c \
147	glut_warp.c \
148	glut_win.c \
149	glut_winmisc.c \
150	win32_glx.c \
151	win32_menu.c \
152	win32_util.c \
153	win32_winproc.c \
154	win32_x11.c
155	
156
157SRCSSEMIGENS = \
158	glut_8x13.c \
159	glut_9x15.c \
160	glut_hel10.c \
161	glut_hel12.c \
162	glut_hel18.c \
163	glut_mroman.c \
164	glut_roman.c \
165	glut_tr10.c \
166	glut_tr24.c
167
168
169
170SOURCES = $(SRCS) $(SRCSSEMIGENS)
171
172OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
173
174.c.o:
175	$(CC) -o $@ $(CFLAGS) -c $<
176.cc.o:
177	$(CXX) -o $@ $(CXXFLAGS) -c $<
178
179
180all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP)
181
182$(LIBDIR):
183	mkdir -p $(LIBDIR)
184
185$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
186	$(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLUT_DLL) $^ $(LDLIBS)
187	$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLUT_DEF) $^
188	$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLUT_IMP) --def $(LIBDIR)/$(GLUT_DEF) 
189
190clean:
191	-$(call UNLINK,*.o)