@ -58,10 +58,13 @@ ifeq ($(OS),Windows_NT)
CGO_LDFLAGS += -static -static-libgcc -static-libstdc++
CGO_LDFLAGS_EXTRA += -lversion
BINARYEN_OPTION += -DCMAKE_EXE_LINKER_FLAGS= '-static-libgcc -static-libstdc++'
USE_SYSTEM_BINARYEN ?= 1
e l s e i f e q ( $( shell uname -s ) , D a r w i n )
MD5SUM = md5
USE_SYSTEM_BINARYEN ?= 1
e l s e i f e q ( $( shell uname -s ) , F r e e B S D )
MD5SUM = md5
START_GROUP = -Wl,--start-group
@ -172,6 +175,7 @@ $(LLVM_BUILDDIR)/build.ninja: llvm-source
$(LLVM_BUILDDIR) : $( LLVM_BUILDDIR ) /build .ninja
cd $( LLVM_BUILDDIR) && ninja $( NINJA_BUILD_TARGETS)
i f n e q ( $( USE_SYSTEM_BINARYEN ) , 1 )
# Build Binaryen
.PHONY : binaryen
binaryen : build /wasm -opt $( EXE )
@ -179,6 +183,7 @@ build/wasm-opt$(EXE):
mkdir -p build
cd lib/binaryen && cmake -G Ninja . -DBUILD_STATIC_LIB= ON $( BINARYEN_OPTION) && ninja bin/wasm-opt$( EXE)
cp lib/binaryen/bin/wasm-opt$( EXE) build/wasm-opt$( EXE)
e n d i f
# Build wasi-libc sysroot
.PHONY : wasi -libc
@ -532,7 +537,7 @@ endif
wasmtest :
$( GO) test ./tests/wasm
build/release : tinygo gen -device wasi -libc binaryen
build/release : tinygo gen -device wasi -libc $( if $ ( filter 1,$ ( USE_SYSTEM_BINARYEN ) ) ,,binaryen )
@mkdir -p build/release/tinygo/bin
@mkdir -p build/release/tinygo/lib/clang/include
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
@ -551,7 +556,9 @@ build/release: tinygo gen-device wasi-libc binaryen
@mkdir -p build/release/tinygo/pkg/armv7em-unknown-unknown-eabi
@echo copying source files
@cp -p build/tinygo$( EXE) build/release/tinygo/bin
i f n e q ( $( USE_SYSTEM_BINARYEN ) , 1 )
@cp -p build/wasm-opt$( EXE) build/release/tinygo/bin
e n d i f
@cp -p $( abspath $( CLANG_SRC) ) /lib/Headers/*.h build/release/tinygo/lib/clang/include
@cp -rp lib/CMSIS/CMSIS/Include build/release/tinygo/lib/CMSIS/CMSIS
@cp -rp lib/CMSIS/README.md build/release/tinygo/lib/CMSIS