makefiles reorganization
Edited to better accomodate to multiple platforms
This commit is contained in:
parent
8847602061
commit
7ea8326b52
2 changed files with 81 additions and 59 deletions
|
@ -26,6 +26,23 @@
|
||||||
# WARNING: To compile examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop()
|
# WARNING: To compile examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop()
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
|
# determine SUBPLATFORM in case PLATFORM_DESKTOP selected
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
SUBPLATFORM=WINDOWS
|
||||||
|
else
|
||||||
|
UNAMEOS = $(shell uname -s)
|
||||||
|
ifeq ($(UNAMEOS),Linux)
|
||||||
|
SUBPLATFORM=LINUX
|
||||||
|
else
|
||||||
|
ifeq ($(UNAMEOS),Darwin)
|
||||||
|
SUBPLATFORM=OSX
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# define compiler: gcc for C program, define as g++ for C++
|
# define compiler: gcc for C program, define as g++ for C++
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# define emscripten compiler
|
# define emscripten compiler
|
||||||
|
@ -44,14 +61,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
else
|
else
|
||||||
CFLAGS = -O2 -Wall -std=c99
|
CFLAGS = -O2 -Wall -std=c99
|
||||||
endif
|
endif
|
||||||
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
|
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
|
||||||
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
|
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
|
||||||
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
|
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
|
|
||||||
# define any directories containing required header files
|
# define any directories containing required header files
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
|
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
|
||||||
|
@ -63,45 +80,37 @@ endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
LFLAGS = -L. -L../src -L/opt/vc/lib
|
LFLAGS = -L. -L../src -L/opt/vc/lib
|
||||||
else
|
else
|
||||||
LFLAGS = -L. -L../src
|
LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define library paths containing required libs
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX)
|
|
||||||
LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/
|
|
||||||
else
|
|
||||||
LFLAGS = -L. -L../src
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# define any libraries to link into executable
|
# define any libraries to link into executable
|
||||||
# if you want to link libraries (libname.so or libname.a), use the -lname
|
# if you want to link libraries (libname.so or libname.a), use the -lname
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(SUBPLATFORM),LINUX)
|
||||||
|
# libraries for Debian GNU/Linux desktop compiling
|
||||||
|
# requires the following packages:
|
||||||
|
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
||||||
|
LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal
|
||||||
|
endif
|
||||||
|
ifeq ($(SUBPLATFORM),OSX)
|
||||||
|
# libraries for OS X 10.9 desktop compiling
|
||||||
|
# requires the following packages:
|
||||||
|
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
||||||
|
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
|
||||||
|
|
||||||
|
else
|
||||||
|
# libraries for Windows desktop compiling
|
||||||
|
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
|
||||||
|
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
# libraries for Raspberry Pi compiling
|
# libraries for Raspberry Pi compiling
|
||||||
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
|
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
|
||||||
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
|
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
|
||||||
else
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX)
|
|
||||||
# libraries for Debian GNU/Linux desktop compiling
|
|
||||||
# requires the following packages:
|
|
||||||
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
|
||||||
LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal
|
|
||||||
else
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX)
|
|
||||||
# libraries for OS X 10.9 desktop compiling
|
|
||||||
# requires the following packages:
|
|
||||||
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
|
||||||
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
|
|
||||||
else
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
LIBS = ../src/libraylib.bc
|
LIBS = ../src/libraylib.bc
|
||||||
else
|
|
||||||
# libraries for Windows desktop compiling
|
|
||||||
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
|
|
||||||
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define additional parameters and flags for windows
|
# define additional parameters and flags for windows
|
||||||
|
@ -280,24 +289,22 @@ audio_music_stream: audio_music_stream.c
|
||||||
|
|
||||||
# clean everything
|
# clean everything
|
||||||
clean:
|
clean:
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(SUBPLATFORM),LINUX)
|
||||||
|
find . -type f -executable -delete
|
||||||
|
rm -f *.o
|
||||||
|
endif
|
||||||
|
ifeq ($(SUBPLATFORM),OSX)
|
||||||
|
rm -f *.o
|
||||||
|
else
|
||||||
|
del *.o *.exe
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
# find . -executable -delete
|
endif
|
||||||
else
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX)
|
|
||||||
find . -type f -executable -delete
|
|
||||||
rm -f *.o
|
|
||||||
else
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX)
|
|
||||||
rm -f *.o
|
|
||||||
else
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
del *.o *.html *.js
|
del *.o *.html *.js
|
||||||
else
|
|
||||||
del *.o *.exe
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
@echo Cleaning done
|
@echo Cleaning done
|
||||||
|
|
||||||
|
|
43
src/makefile
43
src/makefile
|
@ -25,6 +25,23 @@
|
||||||
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
|
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
|
# determine SUBPLATFORM in case PLATFORM_DESKTOP selected
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
SUBPLATFORM=WINDOWS
|
||||||
|
else
|
||||||
|
UNAMEOS = $(shell uname -s)
|
||||||
|
ifeq ($(UNAMEOS),Linux)
|
||||||
|
SUBPLATFORM=LINUX
|
||||||
|
else
|
||||||
|
ifeq ($(UNAMEOS),Darwin)
|
||||||
|
SUBPLATFORM=OSX
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# define raylib graphics api depending on selected platform
|
# define raylib graphics api depending on selected platform
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
# define raylib graphics api to use (on RPI, OpenGL ES 2.0 must be used)
|
# define raylib graphics api to use (on RPI, OpenGL ES 2.0 must be used)
|
||||||
|
@ -34,7 +51,6 @@ else
|
||||||
GRAPHICS ?= GRAPHICS_API_OPENGL_11
|
GRAPHICS ?= GRAPHICS_API_OPENGL_11
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_33 # Uncomment to use OpenGL 3.3
|
#GRAPHICS = GRAPHICS_API_OPENGL_33 # Uncomment to use OpenGL 3.3
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
||||||
endif
|
endif
|
||||||
|
@ -127,23 +143,22 @@ stb_vorbis.o: stb_vorbis.c
|
||||||
|
|
||||||
# clean everything
|
# clean everything
|
||||||
clean:
|
clean:
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(SUBPLATFORM),LINUX)
|
||||||
|
find . -type f -executable -delete
|
||||||
|
rm -f *.o libraylib.a
|
||||||
|
endif
|
||||||
|
ifeq ($(SUBPLATFORM),OSX)
|
||||||
|
rm -f *.o libraylib.a
|
||||||
|
else
|
||||||
|
del *.o libraylib.a
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
rm -f *.o libraylib.a
|
rm -f *.o libraylib.a
|
||||||
else
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX)
|
|
||||||
find . -type f -executable -delete
|
|
||||||
rm -f *.o libraylib.a
|
|
||||||
else
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX)
|
|
||||||
rm -f *.o libraylib.a
|
|
||||||
else
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
del *.o libraylib.bc
|
del *.o libraylib.bc
|
||||||
else
|
|
||||||
del *.o libraylib.a
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
@echo Cleaning done
|
@echo Cleaning done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue