summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2018-12-30 21:10:44 -0800
committerMike Pavone <pavone@retrodev.com>2018-12-30 21:10:44 -0800
commitbef22a39e5abd914eb0fa08b994186a588ee94ce (patch)
treef1eafb48f19b3db6140106d73b6015c70523fb0c /Makefile
parent4f47e90c3d4c6a2d1a36ea48e44bdec042d62cbd (diff)
Added support for GLES in addition to desktop GL
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 19 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 95bd2cc..89e6495 100644
--- a/Makefile
+++ b/Makefile
@@ -31,23 +31,36 @@ TERMINAL:=terminal.o
NET:=net.o
EXE:=
+HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi)
+CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value $(HAS_PROC) -DHAVE_UNISTD_H
+
ifeq ($(OS),Darwin)
LIBS=sdl2 glew
FONT:=nuklear_ui/font_mac.o
else
+ifdef USE_GLES
+LIBS=sdl2 glesv2
+CFLAGS+= -DUSE_GLES
+else
LIBS=sdl2 glew gl
+endif #USE_GLES
FONT:=nuklear_ui/font.o
endif #Darwin
-HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi)
-CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value $(HAS_PROC) -DHAVE_UNISTD_H
ifeq ($(OS),Darwin)
#This should really be based on whether or not the C compiler is clang rather than based on the OS
CFLAGS+= -Wno-logical-op-parentheses
endif
ifdef PORTABLE
+ifdef USE_GLES
+ifndef GLES_LIB
+GLES_LIB:=$(shell pkg-config --libs glesv2)
+endif
+LDFLAGS:=-lm $(GLES_LIB)
+else
CFLAGS+= -DGLEW_STATIC -Iglew/include
LDFLAGS:=-lm glew/lib/libGLEW.a
+endif
ifeq ($(OS),Darwin)
CFLAGS+= -IFrameworks/SDL2.framework/Headers
@@ -55,7 +68,10 @@ LDFLAGS+= -FFrameworks -framework SDL2 -framework OpenGL -framework AppKit
FIXUP:=install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/Frameworks/SDL2.framework/Versions/A/SDL2
else
CFLAGS+= -Isdl/include
-LDFLAGS+= -Wl,-rpath='$$ORIGIN/lib' -Llib -lSDL2 $(shell pkg-config --libs gl)
+LDFLAGS+= -Wl,-rpath='$$ORIGIN/lib' -Llib -lSDL2
+ifndef USE_GLES
+LDFLAGS+= $(shell pkg-config --libs gl)
+endif
endif #Darwin
else