Skip to content
This repository
tree: e9abdf0866
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 377 lines (309 sloc) 11.625 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
include config/version

SHELL = /bin/sh
ifeq ($(NACL_PACKAGES_BITSIZE), 32)
SYSTEM = nacl-32
BIN_EXTENSION = .x86.nexe
CFLAGS.EXTRA = -m32
else
SYSTEM = nacl-64
BIN_EXTENSION = .x64.nexe
CFLAGS.EXTRA = -m64 -DREGAL_NO_ASSERT
#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
endif
REGAL_NACL = 1
SYSTEM.SUPPORTED = $(shell test -f config/Makefile.$(SYSTEM) && echo 1)

ifeq ($(SYSTEM.SUPPORTED), 1)
include config/Makefile.$(SYSTEM)
else
$(error "Platform '$(SYSTEM)' not supported")
endif

REGAL_DEST ?= /usr
BINDIR ?= $(REGAL_DEST)/bin
LIBDIR ?= $(REGAL_DEST)/lib

# To disable stripping of binaries either:
# - use STRIP= on gmake command-line
# - edit this makefile to set STRIP to the empty string
#
# To disable symlinks:
# - use LN= on gmake command-line

AR ?= ar
INSTALL ?= install
STRIP ?= strip
RM ?= rm -f
LN ?= ln -sf

CFLAGS.EXTRA += -fno-exceptions -fno-rtti
ifeq ($(MAKECMDGOALS), debug)
OPT = -g
STRIP :=
else
OPT = $(POPT)
endif
INCLUDE = -Iinclude
CFLAGS = $(OPT) $(WARN) $(INCLUDE) $(CFLAGS.EXTRA)

all debug: regal.lib regal.bin

# REGAL shared and static libraries

export:
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

LIB.LDFLAGS := -lstdc++ -lpthread -ldl -lm -lppapi_gles2
LIB.LIBS :=

LIB.SRCS :=
LIB.SRCS += src/regal/RegalIff.cpp
LIB.SRCS += src/regal/Regal.cpp
LIB.SRCS += src/regal/RegalToken.cpp
LIB.SRCS += src/regal/RegalLog.cpp
LIB.SRCS += src/regal/RegalInit.cpp
LIB.SRCS += src/regal/RegalUtil.cpp
LIB.SRCS += src/regal/RegalConfig.cpp
LIB.SRCS += src/regal/RegalLookup.cpp
LIB.SRCS += src/regal/RegalHelper.cpp
LIB.SRCS += src/regal/RegalContext.cpp
LIB.SRCS += src/regal/RegalContextInfo.cpp
LIB.SRCS += src/regal/RegalDispatchEmu.cpp
LIB.SRCS += src/regal/RegalDispatchLog.cpp
LIB.SRCS += src/regal/RegalDispatchDebug.cpp
LIB.SRCS += src/regal/RegalDispatchError.cpp
LIB.SRCS += src/regal/RegalDispatchLoader.cpp
LIB.SRCS += src/regal/RegalDispatchNacl.cpp
LIB.SRCS += src/regal/RegalDispatchMissing.cpp
LIB.SRCS += src/regal/RegalHttp.cpp
LIB.SRCS += src/regal/RegalFavicon.cpp

ifneq ($(REGAL_NACL), 1)
LIB.SRCS += src/mongoose/mongoose.c
LIB.INCLUDE += -Isrc/mongoose
endif

LIB.SRCS.NAMES := $(notdir $(LIB.SRCS))

LIB.INCLUDE += -Isrc/boost

LIB.DEPS :=
LIB.DEPS += include/GL/Regal.h
LIB.DEPS += src/regal/RegalPrivate.h

LIB.OBJS := $(addprefix tmp/$(SYSTEM)/regal/static/,$(LIB.SRCS.NAMES))
LIB.OBJS := $(LIB.OBJS:.c=.o)
LIB.OBJS := $(LIB.OBJS:.cpp=.o)
LIB.SOBJS := $(addprefix tmp/$(SYSTEM)/regal/shared/,$(LIB.SRCS.NAMES))
LIB.SOBJS := $(LIB.SOBJS:.c=.o)
LIB.SOBJS := $(LIB.SOBJS:.cpp=.o)

CFLAGS += -DREGAL_NO_HTTP

regal.lib: lib lib/$(LIB.SHARED) lib/$(LIB.STATIC)

lib:
mkdir lib

lib/$(LIB.STATIC): $(LIB.OBJS)
$(AR) cr $@ $^
ifneq ($(STRIP),)
$(STRIP) -x $@
endif

lib/$(LIB.SHARED): $(LIB.SOBJS)
$(CC) $(LDFLAGS.SO) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS)
ifneq ($(LN),)
$(LN) $(LIB.SHARED) lib/$(LIB.SONAME)
$(LN) $(LIB.SHARED) lib/$(LIB.DEVLNK)
ifneq ($(LIB.FRAMEWORK),)
$(LN) $(LIB.SHARED) lib/$(LIB.FRAMEWORK)
endif
endif
ifneq ($(STRIP),)
$(STRIP) -x $@
endif

tmp/$(SYSTEM)/regal/static/%.o: src/regal/%.cpp $(LIB.DEPS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<

tmp/$(SYSTEM)/regal/shared/%.o: src/regal/%.cpp $(LIB.DEPS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<

tmp/$(SYSTEM)/regal/static/%.o: src/mongoose/%.c $(LIB.DEPS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<

tmp/$(SYSTEM)/regal/shared/%.o: src/mongoose/%.c $(LIB.DEPS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) $(LIB.INCLUDE) -o $@ -c $<

#
# RegalGLEW
#

GLEW.SRCS += src/glew/src/glew.c
GLEW.SRCS.NAMES := $(notdir $(GLEW.SRCS))
GLEW.OBJS := $(addprefix tmp/$(SYSTEM)/glew/shared/,$(GLEW.SRCS.NAMES))
GLEW.OBJS := $(GLEW.OBJS:.c=.o)
GLEW.CFLAGS := -Isrc/glew/include -Isrc/glu/include -DGLEW_EXPORTS -DGLEW_BUILD -DGLEW_REGAL
GLEW.LIBS := -Llib -lRegal
GLEW.SHARED := libRegalGLEW.$(EXT.DYNAMIC)
GLEW.STATIC := libRegalGLEW.a

glew.lib: lib lib/$(GLEW.SHARED)

tmp/$(SYSTEM)/glew/shared/%.o: src/glew/src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(PICFLAG) $(GLEW.CFLAGS) $(CFLAGS.SO) -o $@ -c $<

lib/$(GLEW.SHARED): $(GLEW.OBJS) lib/$(LIB.SHARED)
$(LD) $(LDFLAGS.DYNAMIC) -o $@ $^ $(LIB.LDFLAGS) $(GLEW.LIBS) -lpthread
ifneq ($(STRIP),)
$(STRIP) -x $@
endif

#
# RegalGLEW glewinfo
#

GLEWINFO.SRCS += src/glew/src/glewinfo.c
GLEWINFO.SRCS.NAMES := $(notdir $(GLEWINFO.SRCS))
GLEWINFO.OBJS := $(addprefix tmp/$(SYSTEM)/glewinfo/static/,$(GLEWINFO.SRCS.NAMES))
GLEWINFO.OBJS := $(GLEWINFO.OBJS:.c=.o)
GLEWINFO.CFLAGS := -Iinclude -Isrc/glew/include -DGLEW_REGAL
GLEWINFO.LIBS += -Llib -lRegal -lRegalGLEW $(LDFLAGS.GLUT) $(LDFLAGS.AGL)

ifneq ($(filter linux%,$(SYSTEM)),)
GLEWINFO.LIBS += -lX11
endif

tmp/$(SYSTEM)/glewinfo/static/%.o: src/glew/src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(GLEWINFO.CFLAGS) $(CFLAGS.SO) -o $@ -c $<

bin/glewinfo: $(GLEWINFO.OBJS) lib/$(LIB.SHARED) lib/$(GLEW.SHARED)
$(LD) -o $@ $^ $(LIB.LDFLAGS) $(GLEWINFO.LIBS)
ifneq ($(STRIP),)
$(STRIP) -x $@
endif


ifneq ($(filter darwin%,$(SYSTEM)),)
glut.lib:

else

#
# RegalGLUT
#

# NOT for windows...

GLUT.SRCS += src/glut/src/capturexfont.c
GLUT.SRCS += src/glut/src/glut_glxext.c
GLUT.SRCS += src/glut/src/glut_menu.c
GLUT.SRCS += src/glut/src/glut_menu2.c
GLUT.SRCS += src/glut/src/layerutil.c

# Windows and Linux...

GLUT.SRCS += src/glut/src/glut_8x13.c
GLUT.SRCS += src/glut/src/glut_9x15.c
GLUT.SRCS += src/glut/src/glut_bitmap.c
GLUT.SRCS += src/glut/src/glut_bwidth.c
GLUT.SRCS += src/glut/src/glut_cindex.c
GLUT.SRCS += src/glut/src/glut_cmap.c
GLUT.SRCS += src/glut/src/glut_cursor.c
GLUT.SRCS += src/glut/src/glut_dials.c
GLUT.SRCS += src/glut/src/glut_dstr.c
GLUT.SRCS += src/glut/src/glut_event.c
GLUT.SRCS += src/glut/src/glut_ext.c
GLUT.SRCS += src/glut/src/glut_fcb.c
GLUT.SRCS += src/glut/src/glut_fullscrn.c
GLUT.SRCS += src/glut/src/glut_gamemode.c
GLUT.SRCS += src/glut/src/glut_get.c
GLUT.SRCS += src/glut/src/glut_hel10.c
GLUT.SRCS += src/glut/src/glut_hel12.c
GLUT.SRCS += src/glut/src/glut_hel18.c
GLUT.SRCS += src/glut/src/glut_init.c
GLUT.SRCS += src/glut/src/glut_input.c
GLUT.SRCS += src/glut/src/glut_joy.c
GLUT.SRCS += src/glut/src/glut_key.c
GLUT.SRCS += src/glut/src/glut_keyctrl.c
GLUT.SRCS += src/glut/src/glut_keyup.c
GLUT.SRCS += src/glut/src/glut_mesa.c
GLUT.SRCS += src/glut/src/glut_modifier.c
GLUT.SRCS += src/glut/src/glut_mroman.c
GLUT.SRCS += src/glut/src/glut_overlay.c
GLUT.SRCS += src/glut/src/glut_roman.c
GLUT.SRCS += src/glut/src/glut_shapes.c
GLUT.SRCS += src/glut/src/glut_space.c
GLUT.SRCS += src/glut/src/glut_stroke.c
GLUT.SRCS += src/glut/src/glut_swap.c
GLUT.SRCS += src/glut/src/glut_swidth.c
GLUT.SRCS += src/glut/src/glut_tablet.c
GLUT.SRCS += src/glut/src/glut_teapot.c
GLUT.SRCS += src/glut/src/glut_tr10.c
GLUT.SRCS += src/glut/src/glut_tr24.c
GLUT.SRCS += src/glut/src/glut_util.c
GLUT.SRCS += src/glut/src/glut_vidresize.c
GLUT.SRCS += src/glut/src/glut_warp.c
GLUT.SRCS += src/glut/src/glut_win.c
GLUT.SRCS += src/glut/src/glut_winmisc.c
GLUT.SRCS += src/glut/src/glut_ppm.c
GLUT.SRCS.NAMES := $(notdir $(GLUT.SRCS))
GLUT.OBJS := $(addprefix tmp/$(SYSTEM)/glut/shared/,$(GLUT.SRCS.NAMES))
GLUT.OBJS := $(GLUT.OBJS:.c=.o)
GLUT.CFLAGS := -Isrc/glut/include -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DGLUT_STATIC
GLUT.LIBS := -Llib -lRegal
GLUT.LIBS += -lGLU -lX11 -lXmu -lXi
GLUT.LIBS += -lpthread -lm
GLUT.SHARED := libRegalGLUT.$(EXT.DYNAMIC)
GLUT.STATIC := libRegalGLUT.a

glut.lib: lib lib/$(GLUT.SHARED)

tmp/$(SYSTEM)/glut/shared/%.o: src/glut/src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(PICFLAG) $(GLUT.CFLAGS) $(CFLAGS.SO) -o $@ -c $<

lib/$(GLUT.SHARED): $(GLUT.OBJS) lib/$(LIB.SHARED)
$(LD) $(LDFLAGS.DYNAMIC) -o $@ $^ $(GLUT.LIBS)
ifneq ($(STRIP),)
$(STRIP) -x $@
endif

endif

# Examples

regal.bin: lib bin bin/nacl$(BIN_EXTENSION)

bin:
mkdir bin

#
# dreamtorus
#

DREAMTORUS.SRCS += examples/dreamtorus/src/render.cpp
DREAMTORUS.SRCS += examples/dreamtorus/glut/code/main.cpp
DREAMTORUS.SRCS.NAMES := $(notdir $(DREAMTORUS.SRCS))
DREAMTORUS.OBJS := $(addprefix tmp/$(SYSTEM)/dreamtorus/static/,$(DREAMTORUS.SRCS.NAMES))
DREAMTORUS.OBJS := $(DREAMTORUS.OBJS:.cpp=.o)
DREAMTORUS.CFLAGS := -Iinclude -Iexamples/dreamtorus/src
DREAMTORUS.LIBS += -Llib -lRegal $(LDFLAGS.GLUT)
DREAMTORUS.LIBS += -lm -lpthread

tmp/$(SYSTEM)/dreamtorus/static/%.o: examples/dreamtorus/src/%.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(DREAMTORUS.CFLAGS) $(CFLAGS.SO) -o $@ -c $<

tmp/$(SYSTEM)/dreamtorus/static/%.o: examples/dreamtorus/glut/code/%.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(DREAMTORUS.CFLAGS) $(CFLAGS.SO) -o $@ -c $<

bin/dreamtorus: $(DREAMTORUS.OBJS) lib/$(LIB.SHARED)
$(LD) -o $@ $^ $(LIB.LDFLAGS) $(DREAMTORUS.LIBS)
ifneq ($(STRIP),)
$(STRIP) -x $@
endif

#
# tiger
#

TIGER.SRCS += examples/tiger/nvpr_tiger.c
TIGER.SRCS += examples/tiger/tiger.c
TIGER.SRCS += examples/tiger/xform.c
TIGER.SRCS.NAMES := $(notdir $(TIGER.SRCS))
TIGER.OBJS := $(addprefix tmp/$(SYSTEM)/tiger/static/,$(TIGER.SRCS.NAMES))
TIGER.OBJS := $(TIGER.OBJS:.c=.o)
TIGER.CFLAGS := -Iinclude
TIGER.LIBS += -Llib -lRegalGLEW $(LDFLAGS.GLUT) -lRegal
TIGER.LIBS += -lm -lpthread

tmp/$(SYSTEM)/tiger/static/%.o: examples/tiger/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(TIGER.CFLAGS) $(CFLAGS.SO) -o $@ -c $<

bin/tiger: $(TIGER.OBJS) lib/$(GLEW.SHARED) lib/$(LIB.SHARED)
$(LD) -o $@ $^ $(TIGER.LIBS)
ifneq ($(STRIP),)
$(STRIP) -x $@
endif

NACLHELLOWORLD.SRCS += examples/nacl/main.cpp
NACLHELLOWORLD.SRCS.NAMES := $(notdir $(NACLHELLOWORLD.SRCS))
NACLHELLOWORLD.OBJS := $(addprefix tmp/$(SYSTEM)/nacl/static/,$(NACLHELLOWORLD.SRCS.NAMES))
NACLHELLOWORLD.OBJS := $(NACLHELLOWORLD.OBJS:.cpp=.o)
NACLHELLOWORLD.CFLAGS := -Iinclude
NACLHELLOWORLD.LIBS += -L./lib -B static -lRegal
NACLHELLOWORLD.LIBS += -lm -lpthread -lppapi -lppapi_gles2 -lstdc++

tmp/$(SYSTEM)/nacl/static/%.o: examples/nacl/%.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(NACLHELLOWORLD.CFLAGS) $(CFLAGS.SO) -o $@ -c $<

bin/nacl$(BIN_EXTENSION): $(NACLHELLOWORLD.OBJS)
$(CC) -o $@ $^ $(NACLHELLOWORLD.LIBS)
ifneq ($(STRIP),)
$(STRIP) -x $@
endif

#
# GLUT dependency for non-Mac builds
#

ifeq ($(filter darwin%,$(SYSTEM)),)
bin/tiger: lib/$(GLUT.SHARED)
bin/dreamtorus: lib/$(GLUT.SHARED)
endif

clean:
$(RM) -r tmp/
$(RM) -r lib/
$(RM) -f bin/nacl$(BIN_EXTENSION)
$(RM) glew.pc glewmx.pc


.PHONY: export
.PHONY: regal.lib regal.bin all debug
.PHONY: clean distclean tardist dist-win32 dist-src
Something went wrong with that request. Please try again.