summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-09-10 19:01:09 +0200
committerraysan5 <[email protected]>2021-09-10 19:01:09 +0200
commitb63c2619e3103b5643d82598eeff818f38957446 (patch)
treefa29feea46a98e6ffd6b7a0bc7c8acc3821289c3 /examples
parent40ec7a6236cec9befab2dcb22d3dce384d76291c (diff)
downloadraylib-b63c2619e3103b5643d82598eeff818f38957446.tar.gz
raylib-b63c2619e3103b5643d82598eeff818f38957446.zip
Update Makefile for web compilation
Some flags are only for the linker, not the compiler
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile59
1 files changed, 32 insertions, 27 deletions
diff --git a/examples/Makefile b/examples/Makefile
index f5cb2175..d9825638 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -25,7 +25,7 @@
# Define required raylib variables
PROJECT_NAME ?= raylib_examples
-RAYLIB_VERSION ?= 3.8.0
+RAYLIB_VERSION ?= 4.0.0
RAYLIB_PATH ?= ..
# Define default options
@@ -185,6 +185,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
MAKE = mingw32-make
endif
endif
+ifeq ($(PLATFORM),PLATFORM_ANDROID)
+ MAKE = mingw32-make
+endif
+ifeq ($(PLATFORM),PLATFORM_WEB)
+ MAKE = mingw32-make
+endif
# Define compiler flags:
# -O1 defines optimization level
@@ -229,32 +235,6 @@ endif
ifeq ($(PLATFORM),PLATFORM_DRM)
CFLAGS += -std=gnu99 -DEGL_NO_X11
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)
- # -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 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
- CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
- EXT = .html
-endif
# Define include paths for required headers
# NOTE: Some external/extras libraries could be required (stb, physac, easings...)
@@ -303,7 +283,32 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
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)
LDFLAGS += -L/opt/vc/lib
endif