|
|
@ -22,14 +22,14 @@ |
|
|
|
#**************************************************************************************************
|
|
|
|
#**************************************************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: all clean |
|
|
|
.PHONY: all clean |
|
|
|
|
|
|
|
# Define required environment variables
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
# Define required variables
|
|
|
|
# Define required raylib variables
|
|
|
|
PROJECT_NAME ?= raylib_game
|
|
|
|
PROJECT_NAME ?= raylib_game
|
|
|
|
RAYLIB_VERSION ?= 3.8.0
|
|
|
|
RAYLIB_VERSION ?= 4.0.0
|
|
|
|
RAYLIB_PATH ?= C:/GitHub/raylib
|
|
|
|
RAYLIB_PATH ?= C:/GitHub/raylib
|
|
|
|
|
|
|
|
|
|
|
|
# Define default options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
|
|
|
# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
|
|
|
PLATFORM ?= PLATFORM_DESKTOP
|
|
|
|
PLATFORM ?= PLATFORM_DESKTOP
|
|
|
|
|
|
|
|
|
|
|
@ -41,12 +41,10 @@ PLATFORM ?= PLATFORM_DESKTOP |
|
|
|
# To enable runtime linking to a special version of libraylib.so, see EXAMPLE_RUNTIME_PATH below.
|
|
|
|
# To enable runtime linking to a special version of libraylib.so, see EXAMPLE_RUNTIME_PATH below.
|
|
|
|
# If there is a libraylib in both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, at runtime,
|
|
|
|
# If there is a libraylib in both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, at runtime,
|
|
|
|
# the library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over the one at RAYLIB_INSTALL_PATH.
|
|
|
|
# the library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over the one at RAYLIB_INSTALL_PATH.
|
|
|
|
|
|
|
|
# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths.
|
|
|
|
# Desired full path to libraylib. No relative paths.
|
|
|
|
|
|
|
|
DESTDIR ?= /usr/local
|
|
|
|
DESTDIR ?= /usr/local
|
|
|
|
RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib
|
|
|
|
RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib
|
|
|
|
|
|
|
|
# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files.
|
|
|
|
# raylib header and associated source files
|
|
|
|
|
|
|
|
RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include
|
|
|
|
RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include
|
|
|
|
|
|
|
|
|
|
|
|
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
|
|
|
|
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
|
|
|
@ -63,6 +61,15 @@ USE_EXTERNAL_GLFW ?= FALSE |
|
|
|
# by default it uses X11 windowing system
|
|
|
|
# by default it uses X11 windowing system
|
|
|
|
USE_WAYLAND_DISPLAY ?= FALSE
|
|
|
|
USE_WAYLAND_DISPLAY ?= FALSE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use cross-compiler for PLATFORM_RPI
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_RPI) |
|
|
|
|
|
|
|
USE_RPI_CROSS_COMPILER ?= FALSE
|
|
|
|
|
|
|
|
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
|
|
|
|
|
|
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
|
|
|
|
|
|
|
|
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
|
|
|
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
|
|
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
|
|
@ -151,8 +158,8 @@ RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src |
|
|
|
# Look for libraylib.so.1 => $(RAYLIB_INSTALL_PATH)/libraylib.so.1 or similar listing.
|
|
|
|
# Look for libraylib.so.1 => $(RAYLIB_INSTALL_PATH)/libraylib.so.1 or similar listing.
|
|
|
|
EXAMPLE_RUNTIME_PATH ?= $(RAYLIB_RELEASE_PATH)
|
|
|
|
EXAMPLE_RUNTIME_PATH ?= $(RAYLIB_RELEASE_PATH)
|
|
|
|
|
|
|
|
|
|
|
|
# Define default C compiler: gcc
|
|
|
|
# Define default C compiler: CC
|
|
|
|
# NOTE: define g++ compiler if using C++
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
CC = gcc
|
|
|
|
CC = gcc
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
@ -179,7 +186,8 @@ ifeq ($(PLATFORM),PLATFORM_WEB) |
|
|
|
CC = emcc
|
|
|
|
CC = emcc
|
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
# Define default make program
|
|
|
|
# Define default make program: MAKE
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
MAKE ?= make
|
|
|
|
MAKE ?= make
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
@ -191,7 +199,8 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) |
|
|
|
MAKE = mingw32-make
|
|
|
|
MAKE = mingw32-make
|
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
# Define compiler flags:
|
|
|
|
# Define compiler flags: CFLAGS
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
# -O1 defines optimization level
|
|
|
|
# -O1 defines optimization level
|
|
|
|
# -g include debug information on compilation
|
|
|
|
# -g include debug information on compilation
|
|
|
|
# -s strip unnecessary data from build
|
|
|
|
# -s strip unnecessary data from build
|
|
|
@ -200,10 +209,10 @@ endif |
|
|
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
|
|
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
|
|
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
|
|
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
|
|
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
|
|
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
|
|
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
|
|
|
CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(BUILD_MODE),DEBUG) |
|
|
|
ifeq ($(BUILD_MODE),DEBUG) |
|
|
|
CFLAGS += -g
|
|
|
|
CFLAGS += -g -D_DEBUG
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
|
|
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
|
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
|
|
endif
|
|
|
|
endif
|
|
|
@ -234,38 +243,18 @@ endif |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DRM) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DRM) |
|
|
|
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
|
|
|
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
|
|
|
endif |
|
|
|
endif |
|
|
|
ifeq ($(PLATFORM),PLATFORM_WEB) |
|
|
|
|
|
|
|
# -Os # size optimization
|
|
|
|
|
|
|
|
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
|
|
|
|
|
|
|
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
|
|
|
|
|
|
|
|
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
|
|
|
|
|
|
|
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
|
|
|
|
|
|
|
|
# -s USE_PTHREADS=1 # multithreading support
|
|
|
|
|
|
|
|
# -s WASM=0 # disable Web Assembly, emitted by default
|
|
|
|
|
|
|
|
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
|
|
|
|
|
|
|
|
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
|
|
|
|
|
|
|
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
|
|
|
|
|
|
|
# --profiling # include information for code profiling
|
|
|
|
|
|
|
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
|
|
|
|
|
|
|
# --preload-file resources # specify a resources folder for data compilation
|
|
|
|
|
|
|
|
# --source-map-base # allow debugging in browser with source map
|
|
|
|
|
|
|
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file resources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Define a custom shell .html and output extension
|
|
|
|
# Define include paths for required headers: INCLUDE_PATHS
|
|
|
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
EXT = .html
|
|
|
|
# NOTE: Some external/extras libraries could be required (stb, physac, easings...)
|
|
|
|
endif |
|
|
|
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLIB_PATH)/src/extras
|
|
|
|
|
|
|
|
|
|
|
|
# Define include paths for required headers
|
|
|
|
|
|
|
|
# NOTE: Several external required libraries (stb and others)
|
|
|
|
|
|
|
|
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Define additional directories containing required header files
|
|
|
|
# Define additional directories containing required header files
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_RPI) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_RPI) |
|
|
|
# RPI required libraries
|
|
|
|
# RPI required libraries
|
|
|
|
INCLUDE_PATHS += -I/opt/vc/include
|
|
|
|
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
|
|
|
INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
|
|
|
|
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
|
|
|
|
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
|
|
|
|
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
|
|
|
|
endif |
|
|
|
endif |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DRM) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DRM) |
|
|
|
# DRM required libraries
|
|
|
|
# DRM required libraries
|
|
|
@ -277,11 +266,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
INCLUDE_PATHS += -I/usr/local/include
|
|
|
|
INCLUDE_PATHS += -I/usr/local/include
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM_OS),LINUX)
|
|
|
|
ifeq ($(PLATFORM_OS),LINUX)
|
|
|
|
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
|
|
|
|
INCLUDE_PATHS += -I$(RAYLIB_H_INSTALL_PATH)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
# Define library paths containing required libs.
|
|
|
|
# Define library paths containing required libs: LDFLAGS
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
|
|
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
@ -295,21 +285,47 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM_OS),BSD)
|
|
|
|
ifeq ($(PLATFORM_OS),BSD)
|
|
|
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
|
|
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
|
|
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
|
|
|
LDFLAGS += -Lsrc -L/usr/local/lib
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(PLATFORM_OS),LINUX)
|
|
|
|
ifeq ($(PLATFORM_OS),LINUX)
|
|
|
|
# Reset everything.
|
|
|
|
# Reset everything.
|
|
|
|
# Precedence: immediately local, installed version, raysan5 provided libs
|
|
|
|
# Precedence: immediately local, installed version, raysan5 provided libs
|
|
|
|
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
|
|
|
|
LDFLAGS += -L$(RAYLIB_INSTALL_PATH)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_WEB) |
|
|
|
|
|
|
|
# -Os # size optimization
|
|
|
|
|
|
|
|
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
|
|
|
|
|
|
|
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
|
|
|
|
|
|
|
|
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
|
|
|
|
|
|
|
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
|
|
|
|
|
|
|
|
# -s USE_PTHREADS=1 # multithreading support
|
|
|
|
|
|
|
|
# -s WASM=0 # disable Web Assembly, emitted by default
|
|
|
|
|
|
|
|
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
|
|
|
|
|
|
|
|
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
|
|
|
|
|
|
|
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
|
|
|
|
|
|
|
# --profiling # include information for code profiling
|
|
|
|
|
|
|
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
|
|
|
|
|
|
|
# --preload-file resources # specify a resources folder for data compilation
|
|
|
|
|
|
|
|
# --source-map-base # allow debugging in browser with source map
|
|
|
|
|
|
|
|
LDFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file $(dir $<)resources@resources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
|
|
|
|
|
|
|
|
# we can compile same code for ALL platforms with no change required, but, working on bigger
|
|
|
|
|
|
|
|
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
|
|
|
|
|
|
|
|
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Define a custom shell .html and output extension
|
|
|
|
|
|
|
|
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
|
|
|
|
|
|
|
EXT = .html
|
|
|
|
|
|
|
|
endif |
|
|
|
ifeq ($(PLATFORM),PLATFORM_RPI) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_RPI) |
|
|
|
LDFLAGS += -L/opt/vc/lib
|
|
|
|
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
|
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
# Define any libraries required on linking
|
|
|
|
# Define libraries required on linking: LDLIBS
|
|
|
|
# if you want to link libraries (libname.so or libname.a), use the -lname
|
|
|
|
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
|
|
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
|
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
|
|
# Libraries for Windows desktop compilation
|
|
|
|
# Libraries for Windows desktop compilation
|
|
|
@ -359,6 +375,9 @@ ifeq ($(PLATFORM),PLATFORM_RPI) |
|
|
|
# Libraries for Raspberry Pi compiling
|
|
|
|
# Libraries for Raspberry Pi compiling
|
|
|
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
|
|
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
|
|
|
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
|
|
|
|
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
|
|
|
|
|
|
|
|
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
|
|
|
|
|
|
LDLIBS += -lvchiq_arm -lvcos
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif |
|
|
|
endif |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DRM) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_DRM) |
|
|
|
# Libraries for DRM compiling
|
|
|
|
# Libraries for DRM compiling
|
|
|
@ -370,7 +389,8 @@ ifeq ($(PLATFORM),PLATFORM_WEB) |
|
|
|
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
|
|
|
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
# Define all source files required
|
|
|
|
# Define source code object files required
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
PROJECT_SOURCE_FILES ?= \
|
|
|
|
PROJECT_SOURCE_FILES ?= \
|
|
|
|
raylib_game.c \
|
|
|
|
raylib_game.c \
|
|
|
|
screen_logo.c \
|
|
|
|
screen_logo.c \
|
|
|
@ -382,6 +402,9 @@ PROJECT_SOURCE_FILES ?= \ |
|
|
|
# Define all object files from source files
|
|
|
|
# Define all object files from source files
|
|
|
|
OBJS = $(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES))
|
|
|
|
OBJS = $(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Define processes to execute
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------------------------
|
|
|
|
# For Android platform we call a custom Makefile.Android
|
|
|
|
# For Android platform we call a custom Makefile.Android
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_ANDROID) |
|
|
|
ifeq ($(PLATFORM),PLATFORM_ANDROID) |
|
|
|
MAKEFILE_PARAMS = -f Makefile.Android
|
|
|
|
MAKEFILE_PARAMS = -f Makefile.Android
|
|
|
|