Makefile 16.2 KB
Newer Older
ikits's avatar
ikits committed
1
2
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
ikits's avatar
ikits committed
3
4
5
6
##
## This program is distributed under the terms and conditions of the GNU
## General Public License Version 2 as published by the Free Software
## Foundation or, at your option, any later version.
mem's avatar
mem committed
7

mem's avatar
mem committed
8
include ../config/version
mem's avatar
mem committed
9

10
11
#GLEW_SPLIT_SOURCE = yes

12
13
SHELL = bash
REGISTRY = registry
ikits's avatar
ikits committed
14
15
REGISTRY_URL = http://www.opengl.org/registry/
#http://oss.sgi.com/projects/ogl-sample/registry/
16
17
18
19
20
BIN = bin
SRC = src
CORE = core
EXT = extensions
BLACKLIST = blacklist
mem's avatar
mem committed
21

ikits's avatar
ikits committed
22
23
24
GL_CORE_SPEC := $(CORE)/GL_VERSION*
GLX_CORE_SPEC := $(CORE)/GLX_VERSION*
ifeq (custom,$(MAKECMDGOALS))
25
26
27
28
29
#GL_CORE_SPEC := $(shell grep GL_VERSION custom.txt | sed 's/\(.*\)/$(CORE)\/\1/g;')
GL_EXT_SPEC := $(shell grep "^[ \t]*GL_" custom.txt | grep -v GL_VERSION | sed 's/\(.*\)/$(EXT)\/\1/g;')
WGL_EXT_SPEC := $(shell grep "^[ \t]*WGL_" custom.txt | sed 's/\(.*\)/$(EXT)\/\1/g;')
#GLX_CORE_SPEC := $(shell grep GLX_VERSION custom.txt | sed 's/\(.*\)/$(CORE)\/\1/g;')
GLX_EXT_SPEC := $(shell grep "^[ \t]*GLX_" custom.txt | grep -v GLX_VERSION | sed 's/\(.*\)/$(EXT)\/\1/g;')
ikits's avatar
ikits committed
30
31
32
else
GL_EXT_SPEC := $(EXT)/GL_*
WGL_EXT_SPEC := $(EXT)/WGL_*
ikits's avatar
ikits committed
33
GLX_EXT_SPEC := $(EXT)/GLX_*
ikits's avatar
ikits committed
34
35
endif

36
PARSE_SPEC = parse_spec.pl
ikits's avatar
ikits committed
37
SYSTEM = $(strip $(shell uname -s))
38
39
40
41
42

TOP = ..
I.DEST = $(TOP)/include/GL
S.DEST = $(TOP)/src
D.DEST = $(TOP)/doc
43
B.DEST = $(TOP)/build/vc6
mem's avatar
mem committed
44

45
46
47
48
I.TARGETS = \
	$(I.DEST)/glew.h \
	$(I.DEST)/wglew.h \
	$(I.DEST)/glxew.h
mem's avatar
mem committed
49

50
51
52
53
54
55
56
ifeq (yes,$(GLEW_SPLIT_SOURCE))
S.TARGETS = \
	$(S.DEST)/glew_def.c \
	$(S.DEST)/glew_init.c \
	$(S.DEST)/glew_str.c \
	$(S.DEST)/glewinfo.c
else
57
58
59
S.TARGETS = \
	$(S.DEST)/glew.c \
	$(S.DEST)/glewinfo.c
60
endif
61
62

D.TARGETS = \
63
64
65
66
	$(D.DEST)/index.html \
	$(D.DEST)/install.html \
	$(D.DEST)/basic.html \
	$(D.DEST)/advanced.html \
67
	$(D.DEST)/build.html \
68
69
	$(D.DEST)/credits.html \
	$(D.DEST)/log.html \
70
71
72
73
	$(D.DEST)/glew.html \
	$(D.DEST)/wglew.html \
	$(D.DEST)/glxew.html

74
75
76
77
78
B.TARGETS = \
	$(B.DEST)/glew.rc \
	$(B.DEST)/glewinfo.rc \
	$(B.DEST)/visualinfo.rc

ikits's avatar
ikits committed
79
all custom: $(I.TARGETS) $(S.TARGETS) $(D.TARGETS) $(B.TARGETS)
80

81
registry: $(REGISTRY)/.dummy
mem's avatar
mem committed
82
83
84
ext: $(EXT)/.dummy

$(REGISTRY)/.dummy: $(BIN)/update_registry.sh
85
86
87
	@echo "--------------------------------------------------------------------"
	@echo "Downloading registry"
	@echo "--------------------------------------------------------------------"
88
	$(BIN)/update_registry.sh $(REGISTRY) $(REGISTRY_URL)
mem's avatar
mem committed
89
90
91
	touch $@

$(EXT)/.dummy: $(REGISTRY)/.dummy
92
93
94
	@echo "--------------------------------------------------------------------"
	@echo "Creating descriptors"
	@echo "--------------------------------------------------------------------"
95
	rm -rf $(EXT)
mem's avatar
mem committed
96
	$(BIN)/update_ext.sh $(EXT) $(REGISTRY) $(BLACKLIST)
ikits's avatar
ikits committed
97
ifeq ($(patsubst Darwin%,Darwin,$(SYSTEM)), Darwin)
ikits's avatar
ikits committed
98
99
	find $(CORE) -maxdepth 1 -type f | grep -v VERSION | grep -v "~" | \
	xargs -J % cp % $(EXT)
ikits's avatar
ikits committed
100
else
ikits's avatar
ikits committed
101
102
	find $(CORE) -maxdepth 1 -type f | grep -v VERSION | grep -v "~" | \
	xargs cp --target-directory=$(EXT)
ikits's avatar
ikits committed
103
endif
mem's avatar
mem committed
104
105
106
	touch $@

$(I.DEST)/glew.h: $(EXT)/.dummy
107
108
109
	@echo "--------------------------------------------------------------------"
	@echo "Creating glew.h"
	@echo "--------------------------------------------------------------------"
110
	test -d $(I.DEST) || mkdir -p $(I.DEST)
111
	cp -f $(SRC)/glew_license.h $@
ikits's avatar
ikits committed
112
113
	cat $(SRC)/mesa_license.h >> $@
	cat $(SRC)/khronos_license.h >> $@
114
	cat $(SRC)/glew_head.h >> $@
ikits's avatar
ikits committed
115
116
	$(BIN)/make_header.pl GLAPIENTRY GL $(GL_CORE_SPEC) >> $@
	$(BIN)/make_header.pl GLAPIENTRY GL $(GL_EXT_SPEC) >> $@
ikits's avatar
ikits committed
117
118
119
	echo -e "/* ------------------------------------------------------------------------- */\n\n#if defined(GLEW_MX) && defined(_WIN32)\n#define GLEW_FUN_EXPORT\n#else\n#define GLEW_FUN_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n" >> $@
	echo -e "#if defined(GLEW_MX)\n#define GLEW_VAR_EXPORT\n#else\n#define GLEW_VAR_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n" >> $@
	echo -e "#if defined(GLEW_MX) && defined(_WIN32)\nstruct GLEWContextStruct\n{\n#endif /* GLEW_MX */" >> $@
ikits's avatar
ikits committed
120
	$(BIN)/make_struct_fun.pl GLEW_FUN_EXPORT $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
ikits's avatar
ikits committed
121
	echo -e "\n#if defined(GLEW_MX) && !defined(_WIN32)\nstruct GLEWContextStruct\n{\n#endif /* GLEW_MX */\n" >> $@
ikits's avatar
ikits committed
122
	$(BIN)/make_struct_var.pl GLEW_VAR_EXPORT $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
ikits's avatar
ikits committed
123
	echo -e "\n#ifdef GLEW_MX\n}; /* GLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@
ikits's avatar
ikits committed
124
	perl -e 's/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/' -pi $@
ikits's avatar
ikits committed
125
	rm -f $@.bak
126
	cat $(SRC)/glew_tail.h >> $@
mem's avatar
mem committed
127
128

$(I.DEST)/wglew.h: $(EXT)/.dummy
129
130
131
132
	@echo "--------------------------------------------------------------------"
	@echo "Creating wglew.h"
	@echo "--------------------------------------------------------------------"
	cp -f $(SRC)/glew_license.h $@
ikits's avatar
ikits committed
133
	cat $(SRC)/khronos_license.h >> $@
134
	cat $(SRC)/wglew_head.h >> $@
ikits's avatar
ikits committed
135
	$(BIN)/make_header.pl WINAPI WGL $(WGL_EXT_SPEC) >> $@
136
137
	cat $(SRC)/wglew_mid.h >> $@
	echo -e "\n#ifdef GLEW_MX\nstruct WGLEWContextStruct\n{\n#endif /* GLEW_MX */" >> $@
138
139
	$(BIN)/make_struct_fun.pl WGLEW_FUN_EXPORT $(WGL_EXT_SPEC) >> $@
	$(BIN)/make_struct_var.pl WGLEW_VAR_EXPORT $(WGL_EXT_SPEC) >> $@
ikits's avatar
ikits committed
140
	echo -e "\n#ifdef GLEW_MX\n}; /* WGLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@
141
	cat $(SRC)/wglew_tail.h >> $@
mem's avatar
mem committed
142
143

$(I.DEST)/glxew.h: $(EXT)/.dummy
144
145
146
147
	@echo "--------------------------------------------------------------------"
	@echo "Creating glxew.h"
	@echo "--------------------------------------------------------------------"
	cp -f $(SRC)/glew_license.h $@
ikits's avatar
ikits committed
148
149
	cat $(SRC)/mesa_license.h >> $@
	cat $(SRC)/khronos_license.h >> $@
150
	cat $(SRC)/glxew_head.h >> $@
ikits's avatar
ikits committed
151
152
	$(BIN)/make_header.pl '' GLX $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_header.pl '' GLX $(GLX_EXT_SPEC) >> $@
153
	cat $(SRC)/glxew_mid.h >> $@
154
	$(BIN)/make_struct_fun.pl GLXEW_FUN_EXPORT $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
ikits's avatar
ikits committed
155
	echo -e "\n#if defined(GLEW_MX)\nstruct GLXEWContextStruct\n{\n#endif /* GLEW_MX */\n" >> $@
156
	$(BIN)/make_struct_var.pl GLXEW_VAR_EXPORT $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
ikits's avatar
ikits committed
157
	echo -e "\n#ifdef GLEW_MX\n}; /* GLXEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@
158
	perl -e 's/GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;/GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;/' -pi $@
159
	cat $(SRC)/glxew_tail.h >> $@
mem's avatar
mem committed
160

161
162
163
164
165
166
167
$(S.DEST)/glew.c: $(EXT)/.dummy
	@echo "--------------------------------------------------------------------"
	@echo "Creating glew.c"
	@echo "--------------------------------------------------------------------"
	cp -f $(SRC)/glew_license.h $@
	cat $(SRC)/glew_head.c >> $@
	echo -e "\n#if !defined(_WIN32) || !defined(GLEW_MX)" >> $@
ikits's avatar
ikits committed
168
169
	$(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) >> $@
	$(BIN)/make_def_fun.pl GL $(GL_EXT_SPEC) >> $@
170
171
172
	echo -e "\n#endif /* !WIN32 || !GLEW_MX */" >> $@
	echo -e "\n#if !defined(GLEW_MX)" >> $@;
	echo -e "\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@
ikits's avatar
ikits committed
173
174
	$(BIN)/make_def_var.pl GL $(GL_CORE_SPEC) >> $@
	$(BIN)/make_def_var.pl GL $(GL_EXT_SPEC) >> $@
175
	echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
ikits's avatar
ikits committed
176
177
	$(BIN)/make_init.pl GL $(GL_CORE_SPEC) >> $@
	$(BIN)/make_init.pl GL $(GL_EXT_SPEC) >> $@
178
	cat $(SRC)/glew_init_gl.c >> $@
ikits's avatar
ikits committed
179
180
	$(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@
	$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
181
182
183
	echo -e "\n  return GLEW_OK;\n}\n" >> $@
	echo -e "\n#if defined(_WIN32)" >> $@
	echo -e "\n#if !defined(GLEW_MX)" >> $@
ikits's avatar
ikits committed
184
185
	$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
	$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@
186
	echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
ikits's avatar
ikits committed
187
	$(BIN)/make_init.pl WGL $(WGL_EXT_SPEC) >> $@
188
	cat $(SRC)/glew_init_wgl.c >> $@
ikits's avatar
ikits committed
189
	$(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@
190
	echo -e "\n  return GLEW_OK;\n}" >> $@;
191
	echo -e "\n#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
192
193
194
195
196
197
198
199
200
201
202
203
204
205
	$(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@
	echo -e "\n#if !defined(GLEW_MX)" >> $@;
	echo -e "\nGLboolean __GLXEW_VERSION_1_0 = GL_FALSE;" >> $@
	echo -e "GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;" >> $@
	$(BIN)/make_def_var.pl GLX $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_def_var.pl GLX $(GLX_EXT_SPEC) >> $@
	echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
	$(BIN)/make_init.pl GLX $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_init.pl GLX $(GLX_EXT_SPEC) >> $@
	cat $(SRC)/glew_init_glx.c >> $@
	$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
	$(BIN)/make_list.pl $(GLX_EXT_SPEC) >> $@
	echo -e "\n  return GLEW_OK;\n}" >> $@
206
	echo -e "\n#endif /* !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */\n" >> $@;
207
208
209
210
211
212
213
214
	cat $(SRC)/glew_init_tail.c >> $@
	cat $(SRC)/glew_str_head.c >> $@
	$(BIN)/make_str.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
	cat $(SRC)/glew_str_wgl.c >> $@
	$(BIN)/make_str.pl $(WGL_EXT_SPEC) >> $@
	cat $(SRC)/glew_str_glx.c >> $@
	$(BIN)/make_str.pl $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
	cat $(SRC)/glew_str_tail.c >> $@
mem's avatar
mem committed
215
	perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@
216
217
218
	perl -e "s/GLEW_VERSION_MAJOR_STRING/$(GLEW_MAJOR)/g" -pi $@
	perl -e "s/GLEW_VERSION_MINOR_STRING/$(GLEW_MINOR)/g" -pi $@
	perl -e "s/GLEW_VERSION_MICRO_STRING/$(GLEW_MICRO)/g" -pi $@
219
	perl -e "s/GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader\(GLEW_CONTEXT_ARG_VAR_INIT\);/{ GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); }/g" -pi $@
ikits's avatar
ikits committed
220
	perl -e "s/\(\(glColorSubTable = /((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)\"glBlendEquation\")) == NULL) || r;\n  r = ((glColorSubTable = /g" -pi $@
221
222
	rm -f $@.bak

223
224
225
226
227
228
229
230
231
232
233
234
235
236
$(S.DEST)/glew_def.c: $(EXT)/.dummy
	cp -f $(SRC)/glew_license.h $@
	echo -e "#include \"glew_utils.h\"\n\n#if !defined(_WIN32) || !defined(GLEW_MX)" >> $@
	$(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) >> $@
	$(BIN)/make_def_fun.pl GL $(GL_EXT_SPEC) >> $@
	echo -e "\n#endif /* !WIN32 || !GLEW_MX */" >> $@
	echo -e "\n#if !defined(GLEW_MX)\n\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@
	$(BIN)/make_def_var.pl GL $(GL_CORE_SPEC) >> $@
	$(BIN)/make_def_var.pl GL $(GL_EXT_SPEC) >> $@
	echo -e "\n#if defined(_WIN32)" >> $@
	$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
	$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@
	echo -e "\n#endif /* _WIN32 */" >> $@
	echo -e "\n#endif /* !GLEW_MX */" >> $@;
237
	echo -e "\n#if !defined(_WIN32) && !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
ikits's avatar
ikits committed
238
239
	$(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@
240
241
242
	echo -e "\n#if !defined(GLEW_MX)" >> $@;
	echo -e "\nGLboolean __GLXEW_VERSION_1_0 = GL_FALSE;" >> $@
	echo -e "GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;" >> $@
ikits's avatar
ikits committed
243
244
	$(BIN)/make_def_var.pl GLX $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_def_var.pl GLX $(GLX_EXT_SPEC) >> $@
245
	echo -e "\n#endif /* !GLEW_MX */" >> $@;
246
	echo -e "\n#endif /* !defined(_WIN32) && !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */" >> $@;
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
	rm -f $@.bak

$(S.DEST)/glew_init.c: $(EXT)/.dummy
	cp -f $(SRC)/glew_license.h $@
	echo -e "#include \"glew_utils.h\"\n" >> $@
	$(BIN)/make_init.pl GL $(GL_CORE_SPEC) >> $@
	$(BIN)/make_init.pl GL $(GL_EXT_SPEC) >> $@
	cat $(SRC)/glew_init_gl.c >> $@
	$(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@
	$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
	echo -e "\n  return GLEW_OK;\n}\n\n#if defined(_WIN32)\n" >> $@;
	$(BIN)/make_init.pl WGL $(WGL_EXT_SPEC) >> $@
	cat $(SRC)/glew_init_wgl.c >> $@
	$(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@
	echo -e "\n  return GLEW_OK;\n}\n\n" >> $@;
	echo -e "\n#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)\n" >> $@
ikits's avatar
ikits committed
263
264
	$(BIN)/make_init.pl GLX $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_init.pl GLX $(GLX_EXT_SPEC) >> $@
265
	cat $(SRC)/glew_init_glx.c >> $@
mem's avatar
mem committed
266
	$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
ikits's avatar
ikits committed
267
	$(BIN)/make_list.pl $(GLX_EXT_SPEC) >> $@
268
269
	echo -e "\n  return GLEW_OK;\n}\n\n#endif /* !__APPLE__ || GLEW_APPLE_GLX */\n" >> $@;
	cat $(SRC)/glew_init_tail.c >> $@
mem's avatar
mem committed
270
	perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@
271
272
273
	perl -e "s/GLEW_VERSION_MAJOR_STRING/$(GLEW_MAJOR)/g" -pi $@
	perl -e "s/GLEW_VERSION_MINOR_STRING/$(GLEW_MINOR)/g" -pi $@
	perl -e "s/GLEW_VERSION_MICRO_STRING/$(GLEW_MICRO)/g" -pi $@
274
	perl -e "s/GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader\(GLEW_CONTEXT_ARG_VAR_INIT\);/{ GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); }/g" -pi $@
ikits's avatar
ikits committed
275
	perl -e "s/\(\(glBlendColor = /((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)\"glBlendEquation\")) == NULL) || r;\n  r = ((glBlendColor = /g" -pi $@
ikits's avatar
ikits committed
276
	rm -f $@.bak
mem's avatar
mem committed
277

278
$(S.DEST)/glew_str.c: $(EXT)/.dummy
279
280
281
	cp -f $(SRC)/glew_license.h $@
	echo -e "\n#include \"glew_utils.h\"\n" >> $@
	cat $(SRC)/glew_str_head.c >> $@
ikits's avatar
ikits committed
282
	$(BIN)/make_str.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
283
	cat $(SRC)/glew_str_wgl.c >> $@
ikits's avatar
ikits committed
284
	$(BIN)/make_str.pl $(WGL_EXT_SPEC) >> $@
285
	cat $(SRC)/glew_str_glx.c >> $@
ikits's avatar
ikits committed
286
	$(BIN)/make_str.pl $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
287
	cat $(SRC)/glew_str_tail.c >> $@
mem's avatar
mem committed
288
#	perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@
289
290
291
#	perl -e "s/GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader\(GLEW_CONTEXT_ARG_VAR_INIT\);/{ GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); }/g" -pi $@
	rm -f $@.bak

mem's avatar
mem committed
292
$(S.DEST)/glewinfo.c: $(EXT)/.dummy
293
294
295
296
297
	@echo "--------------------------------------------------------------------"
	@echo "Creating glewinfo.c"
	@echo "--------------------------------------------------------------------"
	cp -f $(SRC)/glew_license.h $@
	cat $(SRC)/glewinfo_head.c >> $@
ikits's avatar
ikits committed
298
299
	$(BIN)/make_info.pl $(GL_CORE_SPEC) >> $@
	$(BIN)/make_info.pl $(GL_EXT_SPEC) >> $@
mem's avatar
mem committed
300
	echo -e "#ifdef _WIN32\n" >> $@
ikits's avatar
ikits committed
301
	$(BIN)/make_info.pl $(WGL_EXT_SPEC) >> $@
mem's avatar
mem committed
302
	echo -e "#else /* _UNIX */\n" >> $@
ikits's avatar
ikits committed
303
304
	$(BIN)/make_info.pl $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_info.pl $(GLX_EXT_SPEC) >> $@
mem's avatar
mem committed
305
306
307
	echo -e "#endif /* _WIN32 */\n" >> $@

	cat $(SRC)/glewinfo_gl.c >> $@
ikits's avatar
ikits committed
308
309
	$(BIN)/make_info_list.pl $(GL_CORE_SPEC) >> $@
	$(BIN)/make_info_list.pl $(GL_EXT_SPEC) >> $@
mem's avatar
mem committed
310
	cat $(SRC)/glewinfo_wgl.c >> $@
ikits's avatar
ikits committed
311
	$(BIN)/make_info_list.pl $(WGL_EXT_SPEC) >> $@
mem's avatar
mem committed
312
	cat $(SRC)/glewinfo_glx.c >> $@
ikits's avatar
ikits committed
313
314
	$(BIN)/make_info_list.pl $(GLX_CORE_SPEC) >> $@
	$(BIN)/make_info_list.pl $(GLX_EXT_SPEC) >> $@
315
	cat $(SRC)/glewinfo_tail.c >> $@
ikits's avatar
ikits committed
316
	perl -e 's/"glColorSubTable"/"glBlendEquation", glBlendEquation == NULL);\n  glewInfoFunc("glColorSubTable"/g' -pi $@
ikits's avatar
ikits committed
317
	rm -f $@.bak
mem's avatar
mem committed
318

319
320
321
322
323
324
325
# Update documentation

$(D.DEST)/%.html: doc/%.html
	@echo "--------------------------------------------------------------------"
	@echo "Creating $(@F)"
	@echo "--------------------------------------------------------------------"
	cat $(SRC)/header.html $< $(SRC)/footer.html | \
Nigel Stewart's avatar
Nigel Stewart committed
326
	perl -pe 's#<a href="$(@F)">(.*)</a>#\1#' > $@
327

ikits's avatar
ikits committed
328
$(D.DEST)/glew.html: $(EXT)/.dummy
329
330
331
	@echo "--------------------------------------------------------------------"
	@echo "Creating glew.html"
	@echo "--------------------------------------------------------------------"
332
	cp -f $(SRC)/header.html $@
333
	echo -e "<h2>Supported OpenGL Extensions</h2>\n" >> $@
ikits's avatar
ikits committed
334
	$(BIN)/make_html.pl $(GL_EXT_SPEC) >> $@
335
	cat $(SRC)/footer.html >> $@
Nigel Stewart's avatar
Nigel Stewart committed
336
	perl -i -pe 's#<a href="$(@F)">(.*)</a>#\1#' $@
ikits's avatar
ikits committed
337
338

$(D.DEST)/wglew.html: $(EXT)/.dummy
339
340
341
	@echo "--------------------------------------------------------------------"
	@echo "Creating wglew.html"
	@echo "--------------------------------------------------------------------"
342
	cp -f $(SRC)/header.html $@
343
	echo -e "<h2>Supported WGL Extensions</h2>\n" >> $@
ikits's avatar
ikits committed
344
	$(BIN)/make_html.pl $(WGL_EXT_SPEC) >> $@
345
	cat $(SRC)/footer.html >> $@
Nigel Stewart's avatar
Nigel Stewart committed
346
	perl -i -pe 's#<a href="$(@F)">(.*)</a>#\1#' $@
ikits's avatar
ikits committed
347
348

$(D.DEST)/glxew.html: $(EXT)/.dummy
349
350
351
	@echo "--------------------------------------------------------------------"
	@echo "Creating glxew.html"
	@echo "--------------------------------------------------------------------"
352
	cp -f $(SRC)/header.html $@
353
	echo -e "<h2>Supported GLX Extensions</h2>\n" >> $@
ikits's avatar
ikits committed
354
	$(BIN)/make_html.pl $(GLX_EXT_SPEC) >> $@
355
	cat $(SRC)/footer.html >> $@
Nigel Stewart's avatar
Nigel Stewart committed
356
	perl -i -pe 's#<a href="$(@F)">(.*)</a>#\1#' $@
ikits's avatar
ikits committed
357

358
359
360
$(B.DEST)/%.rc: src/%.rc $(EXT)/.dummy
	perl -e "s/GLEW_MAJOR/$(GLEW_MAJOR)/g;s/GLEW_MINOR/$(GLEW_MINOR)/g;s/GLEW_MICRO/$(GLEW_MICRO)/g;" -p $< > $@

mem's avatar
mem committed
361
clean:
ikits's avatar
ikits committed
362
	rm -rf $(I.TARGETS) $(S.TARGETS) $(D.TARGETS) $(B.TARGETS)
mem's avatar
mem committed
363
364

clobber: clean
365
366
367
	rm -rf $(EXT)

destroy: clobber
mem's avatar
mem committed
368
	rm -rf $(REGISTRY)