mirror of
https://github.com/remko/waforth
synced 2025-01-30 08:34:58 +01:00
standalone: Add wasmer to makefile
This commit is contained in:
parent
15d8d91fdc
commit
d40dcc1b4d
2 changed files with 37 additions and 12 deletions
11
README.md
11
README.md
|
@ -33,13 +33,16 @@ document](doc/Design.md).
|
||||||
|
|
||||||
## Standalone shell
|
## Standalone shell
|
||||||
|
|
||||||
Although WAForth is typically used in a web environment (browser, Node.JS), there also is a standalone
|
Although WebAssembly (and therefore WAForth) is typically used in a web environment
|
||||||
command-line shell. You can download a pre-built binary of the standalone shell from
|
(web browsers, Node.js), WAForth also has a standalone command-line shell.
|
||||||
|
You can download a pre-built binary of the standalone shell from
|
||||||
[the Releases page](https://github.com/remko/waforth/releases).
|
[the Releases page](https://github.com/remko/waforth/releases).
|
||||||
|
|
||||||
The standalone shell is built using [wasmtime](https://wasmtime.dev),
|
The standalone shell is built using [wasmtime](https://wasmtime.dev),
|
||||||
but can easily be adapted to be built using other WASM libraries that support the
|
but the build configuration can easily be adapted to build using any
|
||||||
[WebAssembly C API](https://github.com/WebAssembly/wasm-c-api).
|
WebAssembly engine that supports the
|
||||||
|
[WebAssembly C API](https://github.com/WebAssembly/wasm-c-api) (although some
|
||||||
|
have [known issues](https://github.com/remko/waforth/issues/6#issue-326830993)).
|
||||||
|
|
||||||
|
|
||||||
## Using WAForth in a JavaScript application
|
## Using WAForth in a JavaScript application
|
||||||
|
|
|
@ -1,19 +1,44 @@
|
||||||
UNAME_S=$(shell uname -s)
|
UNAME_S=$(shell uname -s)
|
||||||
UNAME_P=$(shell uname -p)
|
UNAME_P=$(shell uname -p)
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
|
################################################
|
||||||
|
# WebAssembly engine configuration
|
||||||
|
################################################
|
||||||
|
|
||||||
|
# Wasmer (https://wasmer.io)
|
||||||
|
# WARNING! Loading compiled words does not work
|
||||||
|
ifeq ($(WASMER),1)
|
||||||
|
WASMER_DIR=$(HOME)/.wasmer
|
||||||
|
CFLAGS=-I$(WASMER_DIR)/include
|
||||||
|
LIBS:=$(WASMER_DIR)/lib/libwasmer.a
|
||||||
|
else
|
||||||
|
|
||||||
|
# Wasmtime (https://wasmtime.dev)
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-macos-c-api
|
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-macos-c-api
|
||||||
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-macos-c-api.tar.xz
|
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-macos-c-api.tar.xz
|
||||||
PACKAGE_SUFFIX=x86_64-macos
|
|
||||||
else
|
else
|
||||||
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-linux-c-api
|
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-linux-c-api
|
||||||
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-linux-c-api.tar.xz
|
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-linux-c-api.tar.xz
|
||||||
LIBS=-lpthread -lm -ldl
|
LIBS=-lpthread -lm -ldl
|
||||||
PACKAGE_SUFFIX=x86_64-linux
|
endif
|
||||||
|
CFLAGS=-I$(WASMTIME_DIR)/include
|
||||||
|
LIBS:=$(WASMTIME_DIR)/lib/libwasmtime.a $(LIBS)
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
-rm -rf wasmtime-*
|
||||||
|
curl -L -s $(WASMTIME_RELEASE_URL) | tar xJv
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS=-I$(WASMTIME_DIR)/include
|
################################################
|
||||||
LDFLAGS=
|
|
||||||
LIBS:=$(WASMTIME_DIR)/lib/libwasmtime.a $(LIBS)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
PACKAGE_SUFFIX=x86_64-macos
|
||||||
|
else
|
||||||
|
PACKAGE_SUFFIX=x86_64-linux
|
||||||
|
endif
|
||||||
|
|
||||||
VERSION?=$(shell cat ../../package.json | grep '"version"' | sed -e 's/.*:.*"\(.*\)".*/\1/')
|
VERSION?=$(shell cat ../../package.json | grep '"version"' | sed -e 's/.*:.*"\(.*\)".*/\1/')
|
||||||
BIN2H=../../scripts/bin2h
|
BIN2H=../../scripts/bin2h
|
||||||
|
@ -37,9 +62,6 @@ waforth_core.h: waforth_core.wasm
|
||||||
$(BIN2H) $< $@
|
$(BIN2H) $< $@
|
||||||
|
|
||||||
.PHONY: install-deps
|
.PHONY: install-deps
|
||||||
install-deps:
|
|
||||||
-rm -rf wasmtime-*
|
|
||||||
curl -L -s $(WASMTIME_RELEASE_URL) | tar xJv
|
|
||||||
|
|
||||||
.PHONY: package
|
.PHONY: package
|
||||||
package: waforth
|
package: waforth
|
||||||
|
|
Loading…
Add table
Reference in a new issue