From ce9f6632635222b38ef0b37b4b1273da4a1877b4 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 16 Apr 2021 17:25:39 +0800 Subject: fix small issues, add web assembly support. --- makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index e4d27fd..4262cfa 100644 --- a/makefile +++ b/makefile @@ -99,6 +99,7 @@ debug: export BIN_PATH := bin/debug shared: export BUILD_PATH := build/shared shared: export BIN_PATH := bin/shared install: export BIN_PATH := bin/release +wasm: export BIN_PATH := bin/release # Find all source files in the source directory, sorted by most # recently modified @@ -116,8 +117,10 @@ ifeq ($(SOURCES),) SOURCES := $(call rwildcard, $(SRC_PATH), *.$(SRC_EXT)) endif +SOURCES := $(filter-out ./src/yue_wasm.cpp, $(SOURCES)) + ifeq ($(NO_LUA),true) - SOURCES := $(filter-out ./src/yuescript/yue.cpp, $(SOURCES)) + SOURCES := $(filter-out ./src/yuescript/yuescript.cpp, $(SOURCES)) endif # Set the object file names, with the source directory stripped @@ -176,13 +179,19 @@ else @echo "Beginning release build" endif ifneq ($(NO_LUA),true) - @$(MAKE) -C ./src/lua + @$(MAKE) generic -C ./src/lua endif @$(START_TIME) @$(MAKE) all --no-print-directory @echo -n "Total build time: " @$(END_TIME) +.PHONY: wasm +wasm: + @$(MAKE) generic CC='emcc -s WASM=1' AR='emar rcu' RANLIB='emranlib' -C ./src/lua + @mkdir -p doc/docs/.vuepress/public/js + @emcc src/yue_wasm.cpp src/yuescript/ast.cpp src/yuescript/parser.cpp src/yuescript/yue_compiler.cpp src/yuescript/yue_parser.cpp src/yuescript/yuescript.cpp src/lua/liblua.a -s WASM=1 -O2 -o doc/docs/.vuepress/public/js/yuescript.js -Isrc -Isrc/lua -std=c++17 --bind -fexceptions + # Debug build for gdb debugging .PHONY: debug debug: dirs @@ -192,7 +201,7 @@ else @echo "Beginning debug build" endif ifneq ($(NO_LUA),true) - @$(MAKE) -C ./src/lua + @$(MAKE) generic -C ./src/lua endif @$(START_TIME) @$(MAKE) all --no-print-directory -- cgit v1.2.3-55-g6feb