diff --git a/examples/Makefile b/examples/Makefile index f5cb2175b..d98256387 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 diff --git a/src/Makefile b/src/Makefile index a56ab1d38..4d98c66e9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -309,7 +309,7 @@ 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 USE_GLFW=3 # Use glfw3 library (context/input management) -> Only for linker! # -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 @@ -318,7 +318,6 @@ ifeq ($(PLATFORM),PLATFORM_WEB) # --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 - CFLAGS += -s USE_GLFW=3 ifeq ($(RAYLIB_BUILD_MODE),DEBUG) CFLAGS += -s ASSERTIONS=1 --profiling endif