comparison Makefile @ 1658:fa9ae059e4d3

Added support for GLES in addition to desktop GL
author Mike Pavone <pavone@retrodev.com>
date Sun, 30 Dec 2018 21:10:44 -0800
parents 774096402918
children 6c54bb5fe3b3 5dacaef602a7
comparison
equal deleted inserted replaced
1657:774096402918 1658:fa9ae059e4d3
29 MEM:=mem.o 29 MEM:=mem.o
30 TERMINAL:=terminal.o 30 TERMINAL:=terminal.o
31 NET:=net.o 31 NET:=net.o
32 EXE:= 32 EXE:=
33 33
34 HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi)
35 CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value $(HAS_PROC) -DHAVE_UNISTD_H
36
34 ifeq ($(OS),Darwin) 37 ifeq ($(OS),Darwin)
35 LIBS=sdl2 glew 38 LIBS=sdl2 glew
36 FONT:=nuklear_ui/font_mac.o 39 FONT:=nuklear_ui/font_mac.o
37 else 40 else
41 ifdef USE_GLES
42 LIBS=sdl2 glesv2
43 CFLAGS+= -DUSE_GLES
44 else
38 LIBS=sdl2 glew gl 45 LIBS=sdl2 glew gl
46 endif #USE_GLES
39 FONT:=nuklear_ui/font.o 47 FONT:=nuklear_ui/font.o
40 endif #Darwin 48 endif #Darwin
41 49
42 HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi)
43 CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value $(HAS_PROC) -DHAVE_UNISTD_H
44 ifeq ($(OS),Darwin) 50 ifeq ($(OS),Darwin)
45 #This should really be based on whether or not the C compiler is clang rather than based on the OS 51 #This should really be based on whether or not the C compiler is clang rather than based on the OS
46 CFLAGS+= -Wno-logical-op-parentheses 52 CFLAGS+= -Wno-logical-op-parentheses
47 endif 53 endif
48 ifdef PORTABLE 54 ifdef PORTABLE
55 ifdef USE_GLES
56 ifndef GLES_LIB
57 GLES_LIB:=$(shell pkg-config --libs glesv2)
58 endif
59 LDFLAGS:=-lm $(GLES_LIB)
60 else
49 CFLAGS+= -DGLEW_STATIC -Iglew/include 61 CFLAGS+= -DGLEW_STATIC -Iglew/include
50 LDFLAGS:=-lm glew/lib/libGLEW.a 62 LDFLAGS:=-lm glew/lib/libGLEW.a
63 endif
51 64
52 ifeq ($(OS),Darwin) 65 ifeq ($(OS),Darwin)
53 CFLAGS+= -IFrameworks/SDL2.framework/Headers 66 CFLAGS+= -IFrameworks/SDL2.framework/Headers
54 LDFLAGS+= -FFrameworks -framework SDL2 -framework OpenGL -framework AppKit 67 LDFLAGS+= -FFrameworks -framework SDL2 -framework OpenGL -framework AppKit
55 FIXUP:=install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/Frameworks/SDL2.framework/Versions/A/SDL2 68 FIXUP:=install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/Frameworks/SDL2.framework/Versions/A/SDL2
56 else 69 else
57 CFLAGS+= -Isdl/include 70 CFLAGS+= -Isdl/include
58 LDFLAGS+= -Wl,-rpath='$$ORIGIN/lib' -Llib -lSDL2 $(shell pkg-config --libs gl) 71 LDFLAGS+= -Wl,-rpath='$$ORIGIN/lib' -Llib -lSDL2
72 ifndef USE_GLES
73 LDFLAGS+= $(shell pkg-config --libs gl)
74 endif
59 endif #Darwin 75 endif #Darwin
60 76
61 else 77 else
62 CFLAGS:=$(shell pkg-config --cflags-only-I $(LIBS)) $(CFLAGS) 78 CFLAGS:=$(shell pkg-config --cflags-only-I $(LIBS)) $(CFLAGS)
63 LDFLAGS:=-lm $(shell pkg-config --libs $(LIBS)) 79 LDFLAGS:=-lm $(shell pkg-config --libs $(LIBS))