Skip to content

Commit

Permalink
Enable size optimization for Emscripten builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mesheets committed Jul 1, 2024
1 parent abab733 commit 650004d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ ifneq (,$(strip $(findstring $(TARGETTYPE), WebAssembly)))
OBJ_SUBDIR_NAME = wobj
EXEC_SUBDIR_NAME = wasm
EXEC_EXT = .html

# Emscripten optimization documentation
# - https://emscripten.org/docs/optimizing/Optimizing-Code.html#optimizing-code
# - https://emscripten.org/docs/tools_reference/emcc.html#emcc-compiler-optimization-options
CFLAGS += -Os

# Documentation for various Emscripten flags
# - Full List: https://github.com/emscripten-core/emscripten/blob/main/src/settings.js
Expand All @@ -117,7 +122,7 @@ ifneq (,$(strip $(findstring $(OSTYPE), Linux)))
TCPOBJ = RCX_TcpPipe_linux
DEFAULT_SERIAL_NAME ?= "/dev/ttyS0"
# Timeout value is 200 in kernel driver module legousbtower.c
LEGO_TOWER_SET_READ_TIMEOUT?= 200
LEGO_TOWER_SET_READ_TIMEOUT ?= 200
CFLAGS += -DLEGO_TOWER_SET_READ_TIMEOUT='$(LEGO_TOWER_SET_READ_TIMEOUT)' -Wno-deprecated
else
ifneq (,$(findstring $(OSTYPE), SunOS))
Expand Down Expand Up @@ -204,7 +209,7 @@ exec: info $(EXEC_DIR)/nqc$(EXEC_EXT)

$(EXEC_DIR)/nqc$(EXEC_EXT): compiler/parse.cpp $(OBJ)
$(MKDIR) $(dir $@)
$(CXX) -o $@ $(CFLAGS_EXEC) $(OBJ) $(LIBS)
$(CXX) -o $@ $(CFLAGS) $(CFLAGS_EXEC) $(OBJ) $(LIBS)

#
# Emscripten build for WebAssembly
Expand Down

0 comments on commit 650004d

Please sign in to comment.