From 25de5b601631dd9246e9806bb4df639bc84431c9 Mon Sep 17 00:00:00 2001 From: Dexter Chua Date: Sun, 6 Dec 2020 18:36:37 +0800 Subject: [PATCH] BLD Refactor emsdk/Makefile (#827) 1. Split long shell command into multiple commands 2. Make BINARYEN_VERSION a variable instead of hardcoding in Makefile 3. Set Makefile.envs and patches as dependencies --- Makefile.envs | 1 + emsdk/Makefile | 24 +++++++++--------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Makefile.envs b/Makefile.envs index bb91ccbfd..fd66353e2 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -1,4 +1,5 @@ export EMSCRIPTEN_VERSION = 1.38.34 +export BINARYEN_VERSION = 1.38.32 export PATH := $(PYODIDE_ROOT)/ccache:$(PYODIDE_ROOT)/emsdk/emsdk:$(PYODIDE_ROOT)/emsdk/emsdk/node/12.18.1_64bit/bin:$(PYODIDE_ROOT)/emsdk/emsdk/binaryen/bin/:$(PYODIDE_ROOT)/emsdk/emsdk/fastcomp/emscripten/:$(PATH) diff --git a/emsdk/Makefile b/emsdk/Makefile index 183e74a38..626b23c9f 100644 --- a/emsdk/Makefile +++ b/emsdk/Makefile @@ -3,23 +3,17 @@ include ../Makefile.envs all: emsdk/.complete -emsdk/.complete: +emsdk/.complete: ../Makefile.envs $(wildcard patches/*.patch) if [ -d emsdk ]; then rm -rf emsdk; fi git clone https://github.com/emscripten-core/emsdk.git - ( \ - cd emsdk && \ - ./emsdk install --build=Release $(EMSCRIPTEN_VERSION)-fastcomp && \ - git clone --branch 1.38.32 --depth 1 https://github.com/WebAssembly/binaryen.git && \ - cd .. && \ - (cat patches/*.patch | patch -p1) && \ - cd emsdk && \ - ./emsdk activate --embedded --build=Release $(EMSCRIPTEN_VERSION)-fastcomp && \ - cd binaryen && \ - cmake . && make -j5 && \ - cd ../.. && \ - sed -i "s/BINARYEN_ROOT.*/BINARYEN_ROOT = emsdk_path \+ '\/binaryen'/g" emsdk/.emscripten && \ - touch emsdk/.complete \ - ) + cd emsdk && ./emsdk install --build=Release $(EMSCRIPTEN_VERSION)-fastcomp + git clone --branch $(BINARYEN_VERSION) --depth 1 https://github.com/WebAssembly/binaryen.git emsdk/binaryen + cat patches/*.patch | patch -p1 + cd emsdk && ./emsdk activate --embedded --build=Release $(EMSCRIPTEN_VERSION)-fastcomp + cmake -S emsdk/binaryen -B emsdk/binaryen + make -C emsdk/binaryen -j5 + sed -i "s/BINARYEN_ROOT.*/BINARYEN_ROOT = emsdk_path \+ '\/binaryen'/g" emsdk/.emscripten + touch emsdk/.complete clean: rm -rf emsdk