Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 377 lines (310 sloc) 11.716 kb
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
1 include config/version
2
3 SHELL = /bin/sh
4 ifeq ($(NACL_PACKAGES_BITSIZE), 32)
5 SYSTEM = nacl-32
b3f40a3 @johnmccutchan Build fixes
johnmccutchan authored
6 BIN_EXTENSION = .x86.nexe
9a64a10 @johnmccutchan Remove unnecessary -melf64_nacl
johnmccutchan authored
7 CFLAGS.EXTRA = -m32
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
8 else
9 SYSTEM = nacl-64
b3f40a3 @johnmccutchan Build fixes
johnmccutchan authored
10 BIN_EXTENSION = .x64.nexe
e9abdf0 @johnmccutchan Remove use of libGLU in nacl example. Add fixed function texture example...
johnmccutchan authored
11 CFLAGS.EXTRA = -m64 -DREGAL_NO_ASSERT
f0ce5e0 @johnmccutchan Demo cleanups
johnmccutchan authored
12 #CFLAGS.EXTRA = -m64 -DREGAL_DEBUG=0 -DREGAL_ERROR=0 -DREGAL_LOG=0 -DREGAL_NO_ASSERT -DREGAL_LOG_APP=0 -DREGAL_LOG_DRIVER=0 -DREGAL_INTERNAL=0 -DREGAL_LOG_HTTP=0
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
13 endif
14 REGAL_NACL = 1
15 SYSTEM.SUPPORTED = $(shell test -f config/Makefile.$(SYSTEM) && echo 1)
16
17 ifeq ($(SYSTEM.SUPPORTED), 1)
18 include config/Makefile.$(SYSTEM)
19 else
20 $(error "Platform '$(SYSTEM)' not supported")
21 endif
22
23 REGAL_DEST ?= /usr
24 BINDIR ?= $(REGAL_DEST)/bin
25 LIBDIR ?= $(REGAL_DEST)/lib
26
27 # To disable stripping of binaries either:
28 # - use STRIP= on gmake command-line
29 # - edit this makefile to set STRIP to the empty string
30 #
31 # To disable symlinks:
32 # - use LN= on gmake command-line
33
34 AR ?= ar
35 INSTALL ?= install
36 STRIP ?= strip
37 RM ?= rm -f
38 LN ?= ln -sf
39
e4655bc @johnmccutchan Make fixes
johnmccutchan authored
40 CFLAGS.EXTRA += -fno-exceptions -fno-rtti
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
41 ifeq ($(MAKECMDGOALS), debug)
42 OPT = -g
43 STRIP :=
44 else
45 OPT = $(POPT)
46 endif
47 INCLUDE = -Iinclude
48 CFLAGS = $(OPT) $(WARN) $(INCLUDE) $(CFLAGS.EXTRA)
49
50 all debug: regal.lib regal.bin
51
52 # REGAL shared and static libraries
53
54 export:
55 scripts/Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
56
e4655bc @johnmccutchan Make fixes
johnmccutchan authored
57 LIB.LDFLAGS := -lstdc++ -lpthread -ldl -lm -lppapi_gles2
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
58 LIB.LIBS :=
59
60 LIB.SRCS :=
61 LIB.SRCS += src/regal/RegalIff.cpp
62 LIB.SRCS += src/regal/Regal.cpp
63 LIB.SRCS += src/regal/RegalToken.cpp
64 LIB.SRCS += src/regal/RegalLog.cpp
65 LIB.SRCS += src/regal/RegalInit.cpp
66 LIB.SRCS += src/regal/RegalUtil.cpp
67 LIB.SRCS += src/regal/RegalConfig.cpp
68 LIB.SRCS += src/regal/RegalLookup.cpp
69 LIB.SRCS += src/regal/RegalHelper.cpp
70 LIB.SRCS += src/regal/RegalContext.cpp
71 LIB.SRCS += src/regal/RegalContextInfo.cpp
72 LIB.SRCS += src/regal/RegalDispatchEmu.cpp
73 LIB.SRCS += src/regal/RegalDispatchLog.cpp
74 LIB.SRCS += src/regal/RegalDispatchDebug.cpp
75 LIB.SRCS += src/regal/RegalDispatchError.cpp
76 LIB.SRCS += src/regal/RegalDispatchLoader.cpp
9a64a10 @johnmccutchan Remove unnecessary -melf64_nacl
johnmccutchan authored
77 LIB.SRCS += src/regal/RegalDispatchNacl.cpp
1bd8eae @nigels-com Add EGL static dispatch initialisation for ES2/EGL static linking purpos...
nigels-com authored
78 LIB.SRCS += src/regal/RegalDispatchStaticES2.cpp
79 LIB.SRCS += src/regal/RegalDispatchStaticEGL.cpp
9a64a10 @johnmccutchan Remove unnecessary -melf64_nacl
johnmccutchan authored
80 LIB.SRCS += src/regal/RegalDispatchMissing.cpp
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
81 LIB.SRCS += src/regal/RegalHttp.cpp
82 LIB.SRCS += src/regal/RegalFavicon.cpp
83
84 ifneq ($(REGAL_NACL), 1)
85 LIB.SRCS += src/mongoose/mongoose.c
86 LIB.INCLUDE += -Isrc/mongoose
87 endif
88
89 LIB.SRCS.NAMES := $(notdir $(LIB.SRCS))
90
91 LIB.INCLUDE += -Isrc/boost
92
93 LIB.DEPS :=
94 LIB.DEPS += include/GL/Regal.h
95 LIB.DEPS += src/regal/RegalPrivate.h
96
97 LIB.OBJS := $(addprefix tmp/$(SYSTEM)/regal/static/,$(LIB.SRCS.NAMES))
98 LIB.OBJS := $(LIB.OBJS:.c=.o)
99 LIB.OBJS := $(LIB.OBJS:.cpp=.o)
100 LIB.SOBJS := $(addprefix tmp/$(SYSTEM)/regal/shared/,$(LIB.SRCS.NAMES))
101 LIB.SOBJS := $(LIB.SOBJS:.c=.o)
102 LIB.SOBJS := $(LIB.SOBJS:.cpp=.o)
103
acbbdbc @nigels-com Annotate gl.py with enableCap for ES 2.0 allowed glEnable caps.
nigels-com authored
104 regal.lib: lib lib/$(LIB.SHARED) lib/$(LIB.STATIC)
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
105
106 lib:
107 mkdir lib
108
109 lib/$(LIB.STATIC): $(LIB.OBJS)
110 $(AR) cr $@ $^
111 ifneq ($(STRIP),)
112 $(STRIP) -x $@
113 endif
114
115 lib/$(LIB.SHARED): $(LIB.SOBJS)
e4655bc @johnmccutchan Make fixes
johnmccutchan authored
116 $(CC) $(LDFLAGS.SO) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS)
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
117 ifneq ($(LN),)
118 $(LN) $(LIB.SHARED) lib/$(LIB.SONAME)
119 $(LN) $(LIB.SHARED) lib/$(LIB.DEVLNK)
120 ifneq ($(LIB.FRAMEWORK),)
121 $(LN) $(LIB.SHARED) lib/$(LIB.FRAMEWORK)
122 endif
123 endif
124 ifneq ($(STRIP),)
125 $(STRIP) -x $@
126 endif
127
128 tmp/$(SYSTEM)/regal/static/%.o: src/regal/%.cpp $(LIB.DEPS)
129 @mkdir -p $(dir $@)
130 $(CC) $(CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
131
132 tmp/$(SYSTEM)/regal/shared/%.o: src/regal/%.cpp $(LIB.DEPS)
133 @mkdir -p $(dir $@)
134 $(CC) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
135
136 tmp/$(SYSTEM)/regal/static/%.o: src/mongoose/%.c $(LIB.DEPS)
137 @mkdir -p $(dir $@)
138 $(CC) $(CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
139
140 tmp/$(SYSTEM)/regal/shared/%.o: src/mongoose/%.c $(LIB.DEPS)
141 @mkdir -p $(dir $@)
142 $(CC) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<
143
144 #
145 # RegalGLEW
146 #
147
148 GLEW.SRCS += src/glew/src/glew.c
149 GLEW.SRCS.NAMES := $(notdir $(GLEW.SRCS))
150 GLEW.OBJS := $(addprefix tmp/$(SYSTEM)/glew/shared/,$(GLEW.SRCS.NAMES))
151 GLEW.OBJS := $(GLEW.OBJS:.c=.o)
152 GLEW.CFLAGS := -Isrc/glew/include -Isrc/glu/include -DGLEW_EXPORTS -DGLEW_BUILD -DGLEW_REGAL
153 GLEW.LIBS := -Llib -lRegal
154 GLEW.SHARED := libRegalGLEW.$(EXT.DYNAMIC)
155 GLEW.STATIC := libRegalGLEW.a
156
157 glew.lib: lib lib/$(GLEW.SHARED)
158
159 tmp/$(SYSTEM)/glew/shared/%.o: src/glew/src/%.c
160 @mkdir -p $(dir $@)
161 $(CC) $(CFLAGS) $(PICFLAG) $(GLEW.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
162
163 lib/$(GLEW.SHARED): $(GLEW.OBJS) lib/$(LIB.SHARED)
164 $(LD) $(LDFLAGS.DYNAMIC) -o $@ $^ $(LIB.LDFLAGS) $(GLEW.LIBS) -lpthread
165 ifneq ($(STRIP),)
166 $(STRIP) -x $@
167 endif
168
169 #
170 # RegalGLEW glewinfo
171 #
172
173 GLEWINFO.SRCS += src/glew/src/glewinfo.c
174 GLEWINFO.SRCS.NAMES := $(notdir $(GLEWINFO.SRCS))
175 GLEWINFO.OBJS := $(addprefix tmp/$(SYSTEM)/glewinfo/static/,$(GLEWINFO.SRCS.NAMES))
176 GLEWINFO.OBJS := $(GLEWINFO.OBJS:.c=.o)
177 GLEWINFO.CFLAGS := -Iinclude -Isrc/glew/include -DGLEW_REGAL
178 GLEWINFO.LIBS += -Llib -lRegal -lRegalGLEW $(LDFLAGS.GLUT) $(LDFLAGS.AGL)
179
180 ifneq ($(filter linux%,$(SYSTEM)),)
181 GLEWINFO.LIBS += -lX11
182 endif
183
184 tmp/$(SYSTEM)/glewinfo/static/%.o: src/glew/src/%.c
185 @mkdir -p $(dir $@)
186 $(CC) $(CFLAGS) $(GLEWINFO.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
187
188 bin/glewinfo: $(GLEWINFO.OBJS) lib/$(LIB.SHARED) lib/$(GLEW.SHARED)
189 $(LD) -o $@ $^ $(LIB.LDFLAGS) $(GLEWINFO.LIBS)
190 ifneq ($(STRIP),)
191 $(STRIP) -x $@
192 endif
193
194
195 ifneq ($(filter darwin%,$(SYSTEM)),)
196 glut.lib:
197
198 else
199
200 #
201 # RegalGLUT
202 #
203
204 # NOT for windows...
205
206 GLUT.SRCS += src/glut/src/capturexfont.c
207 GLUT.SRCS += src/glut/src/glut_glxext.c
208 GLUT.SRCS += src/glut/src/glut_menu.c
209 GLUT.SRCS += src/glut/src/glut_menu2.c
210 GLUT.SRCS += src/glut/src/layerutil.c
211
212 # Windows and Linux...
213
214 GLUT.SRCS += src/glut/src/glut_8x13.c
215 GLUT.SRCS += src/glut/src/glut_9x15.c
216 GLUT.SRCS += src/glut/src/glut_bitmap.c
217 GLUT.SRCS += src/glut/src/glut_bwidth.c
218 GLUT.SRCS += src/glut/src/glut_cindex.c
219 GLUT.SRCS += src/glut/src/glut_cmap.c
220 GLUT.SRCS += src/glut/src/glut_cursor.c
221 GLUT.SRCS += src/glut/src/glut_dials.c
222 GLUT.SRCS += src/glut/src/glut_dstr.c
223 GLUT.SRCS += src/glut/src/glut_event.c
224 GLUT.SRCS += src/glut/src/glut_ext.c
225 GLUT.SRCS += src/glut/src/glut_fcb.c
226 GLUT.SRCS += src/glut/src/glut_fullscrn.c
227 GLUT.SRCS += src/glut/src/glut_gamemode.c
228 GLUT.SRCS += src/glut/src/glut_get.c
229 GLUT.SRCS += src/glut/src/glut_hel10.c
230 GLUT.SRCS += src/glut/src/glut_hel12.c
231 GLUT.SRCS += src/glut/src/glut_hel18.c
232 GLUT.SRCS += src/glut/src/glut_init.c
233 GLUT.SRCS += src/glut/src/glut_input.c
234 GLUT.SRCS += src/glut/src/glut_joy.c
235 GLUT.SRCS += src/glut/src/glut_key.c
236 GLUT.SRCS += src/glut/src/glut_keyctrl.c
237 GLUT.SRCS += src/glut/src/glut_keyup.c
238 GLUT.SRCS += src/glut/src/glut_mesa.c
239 GLUT.SRCS += src/glut/src/glut_modifier.c
240 GLUT.SRCS += src/glut/src/glut_mroman.c
241 GLUT.SRCS += src/glut/src/glut_overlay.c
242 GLUT.SRCS += src/glut/src/glut_roman.c
243 GLUT.SRCS += src/glut/src/glut_shapes.c
244 GLUT.SRCS += src/glut/src/glut_space.c
245 GLUT.SRCS += src/glut/src/glut_stroke.c
246 GLUT.SRCS += src/glut/src/glut_swap.c
247 GLUT.SRCS += src/glut/src/glut_swidth.c
248 GLUT.SRCS += src/glut/src/glut_tablet.c
249 GLUT.SRCS += src/glut/src/glut_teapot.c
250 GLUT.SRCS += src/glut/src/glut_tr10.c
251 GLUT.SRCS += src/glut/src/glut_tr24.c
252 GLUT.SRCS += src/glut/src/glut_util.c
253 GLUT.SRCS += src/glut/src/glut_vidresize.c
254 GLUT.SRCS += src/glut/src/glut_warp.c
255 GLUT.SRCS += src/glut/src/glut_win.c
256 GLUT.SRCS += src/glut/src/glut_winmisc.c
257 GLUT.SRCS += src/glut/src/glut_ppm.c
258 GLUT.SRCS.NAMES := $(notdir $(GLUT.SRCS))
259 GLUT.OBJS := $(addprefix tmp/$(SYSTEM)/glut/shared/,$(GLUT.SRCS.NAMES))
260 GLUT.OBJS := $(GLUT.OBJS:.c=.o)
261 GLUT.CFLAGS := -Isrc/glut/include -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DGLUT_STATIC
262 GLUT.LIBS := -Llib -lRegal
263 GLUT.LIBS += -lGLU -lX11 -lXmu -lXi
264 GLUT.LIBS += -lpthread -lm
265 GLUT.SHARED := libRegalGLUT.$(EXT.DYNAMIC)
266 GLUT.STATIC := libRegalGLUT.a
267
268 glut.lib: lib lib/$(GLUT.SHARED)
269
270 tmp/$(SYSTEM)/glut/shared/%.o: src/glut/src/%.c
271 @mkdir -p $(dir $@)
272 $(CC) $(CFLAGS) $(PICFLAG) $(GLUT.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
273
274 lib/$(GLUT.SHARED): $(GLUT.OBJS) lib/$(LIB.SHARED)
275 $(LD) $(LDFLAGS.DYNAMIC) -o $@ $^ $(GLUT.LIBS)
276 ifneq ($(STRIP),)
277 $(STRIP) -x $@
278 endif
279
280 endif
281
282 # Examples
283
b3f40a3 @johnmccutchan Build fixes
johnmccutchan authored
284 regal.bin: lib bin bin/nacl$(BIN_EXTENSION)
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
285
286 bin:
287 mkdir bin
288
289 #
290 # dreamtorus
291 #
292
293 DREAMTORUS.SRCS += examples/dreamtorus/src/render.cpp
294 DREAMTORUS.SRCS += examples/dreamtorus/glut/code/main.cpp
295 DREAMTORUS.SRCS.NAMES := $(notdir $(DREAMTORUS.SRCS))
296 DREAMTORUS.OBJS := $(addprefix tmp/$(SYSTEM)/dreamtorus/static/,$(DREAMTORUS.SRCS.NAMES))
297 DREAMTORUS.OBJS := $(DREAMTORUS.OBJS:.cpp=.o)
298 DREAMTORUS.CFLAGS := -Iinclude -Iexamples/dreamtorus/src
299 DREAMTORUS.LIBS += -Llib -lRegal $(LDFLAGS.GLUT)
300 DREAMTORUS.LIBS += -lm -lpthread
301
302 tmp/$(SYSTEM)/dreamtorus/static/%.o: examples/dreamtorus/src/%.cpp
303 @mkdir -p $(dir $@)
304 $(CC) $(CFLAGS) $(DREAMTORUS.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
305
306 tmp/$(SYSTEM)/dreamtorus/static/%.o: examples/dreamtorus/glut/code/%.cpp
307 @mkdir -p $(dir $@)
308 $(CC) $(CFLAGS) $(DREAMTORUS.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
309
310 bin/dreamtorus: $(DREAMTORUS.OBJS) lib/$(LIB.SHARED)
311 $(LD) -o $@ $^ $(LIB.LDFLAGS) $(DREAMTORUS.LIBS)
312 ifneq ($(STRIP),)
313 $(STRIP) -x $@
314 endif
315
316 #
317 # tiger
318 #
319
320 TIGER.SRCS += examples/tiger/nvpr_tiger.c
321 TIGER.SRCS += examples/tiger/tiger.c
322 TIGER.SRCS += examples/tiger/xform.c
323 TIGER.SRCS.NAMES := $(notdir $(TIGER.SRCS))
324 TIGER.OBJS := $(addprefix tmp/$(SYSTEM)/tiger/static/,$(TIGER.SRCS.NAMES))
325 TIGER.OBJS := $(TIGER.OBJS:.c=.o)
326 TIGER.CFLAGS := -Iinclude
327 TIGER.LIBS += -Llib -lRegalGLEW $(LDFLAGS.GLUT) -lRegal
328 TIGER.LIBS += -lm -lpthread
329
330 tmp/$(SYSTEM)/tiger/static/%.o: examples/tiger/%.c
331 @mkdir -p $(dir $@)
332 $(CC) $(CFLAGS) $(TIGER.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
333
334 bin/tiger: $(TIGER.OBJS) lib/$(GLEW.SHARED) lib/$(LIB.SHARED)
335 $(LD) -o $@ $^ $(TIGER.LIBS)
336 ifneq ($(STRIP),)
337 $(STRIP) -x $@
338 endif
339
340 NACLHELLOWORLD.SRCS += examples/nacl/main.cpp
341 NACLHELLOWORLD.SRCS.NAMES := $(notdir $(NACLHELLOWORLD.SRCS))
342 NACLHELLOWORLD.OBJS := $(addprefix tmp/$(SYSTEM)/nacl/static/,$(NACLHELLOWORLD.SRCS.NAMES))
343 NACLHELLOWORLD.OBJS := $(NACLHELLOWORLD.OBJS:.cpp=.o)
344 NACLHELLOWORLD.CFLAGS := -Iinclude
e9abdf0 @johnmccutchan Remove use of libGLU in nacl example. Add fixed function texture example...
johnmccutchan authored
345 NACLHELLOWORLD.LIBS += -L./lib -B static -lRegal
346 NACLHELLOWORLD.LIBS += -lm -lpthread -lppapi -lppapi_gles2 -lstdc++
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
347
348 tmp/$(SYSTEM)/nacl/static/%.o: examples/nacl/%.cpp
349 @mkdir -p $(dir $@)
350 $(CC) $(CFLAGS) $(NACLHELLOWORLD.CFLAGS) $(CFLAGS.SO) -o $@ -c $<
351
e4655bc @johnmccutchan Make fixes
johnmccutchan authored
352 bin/nacl$(BIN_EXTENSION): $(NACLHELLOWORLD.OBJS)
353 $(CC) -o $@ $^ $(NACLHELLOWORLD.LIBS)
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
354 ifneq ($(STRIP),)
355 $(STRIP) -x $@
356 endif
357
358 #
359 # GLUT dependency for non-Mac builds
360 #
361
362 ifeq ($(filter darwin%,$(SYSTEM)),)
363 bin/tiger: lib/$(GLUT.SHARED)
364 bin/dreamtorus: lib/$(GLUT.SHARED)
365 endif
366
367 clean:
368 $(RM) -r tmp/
369 $(RM) -r lib/
e4655bc @johnmccutchan Make fixes
johnmccutchan authored
370 $(RM) -f bin/nacl$(BIN_EXTENSION)
8fa358a @johnmccutchan Initial cut of NaCL build configuration
johnmccutchan authored
371 $(RM) glew.pc glewmx.pc
372
373
374 .PHONY: export
375 .PHONY: regal.lib regal.bin all debug
376 .PHONY: clean distclean tardist dist-win32 dist-src
Something went wrong with that request. Please try again.