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
This commit is contained in:
Dexter Chua 2020-12-06 18:36:37 +08:00 committed by GitHub
parent 68d0d8229e
commit 25de5b6016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 15 deletions

View File

@ -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)

View File

@ -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