Skip to content

Commit

Permalink
update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Nov 11, 2024
1 parent 3c2aa5c commit c7e5209
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions examples/Makefile.Web
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ BUILD_WEB_HEAP_SIZE ?= 134217728
USE_WEBGL2 ?= FALSE

# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB, PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB PLATFORM_WEB_RGFW))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
Expand Down Expand Up @@ -116,7 +116,8 @@ endif
# Define raylib release directory for compiled library
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src

ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))

ifeq ($(PLATFORM),$(filter $(PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
Expand All @@ -142,7 +143,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
CC = clang
endif
endif
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM),$(filter $(PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# HTML5 emscripten compiler
# WARNING: To compile to HTML5, code must be redesigned
# to use emscripten.h and emscripten_set_main_loop()
Expand All @@ -161,7 +162,7 @@ endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
MAKE = mingw32-make
endif
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM),$(filter $(PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(OS),Windows_NT)
MAKE = mingw32-make
else
Expand Down Expand Up @@ -193,7 +194,7 @@ ifeq ($(BUILD_MODE),DEBUG)
CFLAGS += -sASSERTIONS=1 --profiling
endif
else
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM),$(filter $(PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
CFLAGS += -O3
else
Expand Down Expand Up @@ -263,7 +264,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
endif
endif
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM),$(filter $(PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
Expand All @@ -279,15 +280,13 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_
# --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


ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(PLATFORM),PLATFORM_WEB)
LDFLAGS += -sUSE_GLFW=3
endif

LDFLAGS += -sEXPORTED_RUNTIME_METHODS=ccall

# Build using asyncify
# Build using asyncify
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
LDFLAGS += -sASYNCIFY
endif
Expand Down Expand Up @@ -369,7 +368,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
# NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
endif
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM),$(filter $(PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
endif
Expand Down Expand Up @@ -1177,7 +1176,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
find . -type f -executable -delete
rm -fv *.o
endif
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM),$(filter $(PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
del *.o *.html *.js
endif
@echo Cleaning done
Expand Down

0 comments on commit c7e5209

Please sign in to comment.