Skip to content

Commit

Permalink
Remove local copying of emsdk_env.sh (dotnet#39004)
Browse files Browse the repository at this point in the history
Recent versions of emsdk stopped supporting the construct_env argument: emscripten-core/emsdk@819e95c
Sourcing the normal isn't that slow anyway, it takes about 300ms on my machine
  • Loading branch information
akoeplinger authored Jul 9, 2020
1 parent b4938fe commit 9c73452
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/mono/wasm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/emsdk_env.sh
!Makefile
15 changes: 5 additions & 10 deletions src/mono/wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ all: build-native timezone-data

EMSCRIPTEN_VERSION=1.39.16
EMSDK_LOCAL_PATH=emsdk
EMCC=source $(CURDIR)/emsdk_env.sh && emcc
EMCC=source $(EMSDK_PATH)/emsdk_env.sh && emcc

.stamp-wasm-install-and-select-$(EMSCRIPTEN_VERSION):
rm -rf $(EMSDK_LOCAL_PATH)
Expand All @@ -42,10 +42,6 @@ else
provision-wasm:
endif

# emsdk_env.sh calls emsdk construct_env which is a bit slow so make a copy
emsdk_env.sh: | provision-wasm
cd $(EMSDK_PATH) && ./emsdk construct_env $(CURDIR)/emsdk_env.sh

MONO_OBJ_DIR=$(OBJDIR)/mono/Browser.wasm.$(CONFIG)
MONO_INCLUDE_DIR=$(MONO_BIN_DIR)/include/mono-2.0
BUILDS_OBJ_DIR=$(MONO_OBJ_DIR)/wasm
Expand Down Expand Up @@ -75,19 +71,19 @@ $(BUILDS_BIN_DIR):
$(BUILDS_OBJ_DIR):
mkdir -p $$@

$(BUILDS_BIN_DIR)/dotnet.js: $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o runtime/library_mono.js runtime/binding_support.js runtime/dotnet_support.js $(2) | $(BUILDS_BIN_DIR)/ emsdk_env.sh
$(BUILDS_BIN_DIR)/dotnet.js: $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o runtime/library_mono.js runtime/binding_support.js runtime/dotnet_support.js $(2) | $(BUILDS_BIN_DIR)/
$(EMCC) $(EMCC_FLAGS) $(1) --js-library runtime/library_mono.js --js-library runtime/binding_support.js --js-library runtime/dotnet_support.js $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o $(2) -o $(BUILDS_BIN_DIR)/dotnet.js

$(BUILDS_OBJ_DIR)/pinvoke-table.h: $(PINVOKE_TABLE) | $(BUILDS_OBJ_DIR)
if cmp -s $(PINVOKE_TABLE) $$@ ; then : ; else cp $(PINVOKE_TABLE) $$@ ; fi

$(BUILDS_OBJ_DIR)/driver.o: runtime/driver.c runtime/corebindings.c | $(BUILDS_OBJ_DIR) emsdk_env.sh
$(BUILDS_OBJ_DIR)/driver.o: runtime/driver.c runtime/corebindings.c | $(BUILDS_OBJ_DIR)
$(EMCC) $(EMCC_FLAGS) $(1) -Oz -DCORE_BINDINGS -I$(BUILDS_OBJ_DIR) -I$(MONO_INCLUDE_DIR) runtime/driver.c -c -o $$@

$(BUILDS_OBJ_DIR)/pinvoke.o: runtime/pinvoke.c runtime/pinvoke.h $(BUILDS_OBJ_DIR)/pinvoke-table.h | $(BUILDS_OBJ_DIR) emsdk_env.sh
$(BUILDS_OBJ_DIR)/pinvoke.o: runtime/pinvoke.c runtime/pinvoke.h $(BUILDS_OBJ_DIR)/pinvoke-table.h | $(BUILDS_OBJ_DIR)
$(EMCC) $(EMCC_FLAGS) $(1) -Oz -DGEN_PINVOKE=1 -I$(BUILDS_OBJ_DIR) -I$(MONO_INCLUDE_DIR) runtime/pinvoke.c -c -o $$@

$(BUILDS_OBJ_DIR)/corebindings.o: runtime/corebindings.c | $(BUILDS_OBJ_DIR) emsdk_env.sh
$(BUILDS_OBJ_DIR)/corebindings.o: runtime/corebindings.c | $(BUILDS_OBJ_DIR)
$(EMCC) $(1) -Oz -I$(MONO_INCLUDE_DIR) runtime/corebindings.c -c -o $$@

build-native: $(BUILDS_BIN_DIR)/dotnet.js
Expand All @@ -108,7 +104,6 @@ clean-emsdk:

clean:
$(RM) -rf $(BUILDS_BIN_DIR) $(BUILDS_OBJ_DIR)
$(RM) emsdk_env.sh

# Helper targets
.PHONY: runtime
Expand Down

0 comments on commit 9c73452

Please sign in to comment.