-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (31 loc) · 841 Bytes
/
Makefile
File metadata and controls
48 lines (31 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# Makefile for the dwasm build
#
# Assume tools are available in the PATH if not explicitly overridden
GO ?= go
WAT2WASM ?= wat2wasm
# Sample .wasm binaries for exercising the VM
SAMPLES_WAT := $(wildcard samples/*.wat)
SAMPLES_WASM := $(SAMPLES_WAT:.wat=.wasm)
# By default, build everything: VM, sample code, etc
DWASM := dwasm
all: $(DWASM) $(SAMPLES_WASM)
# Main CLI/VM binary
$(DWASM): $(wildcard *.go) $(wildcard wasm/*.go) Makefile
@$(GO) build
# Compile a single .wat source file into the corresponding .wasm
%.wasm : %.wat
@$(WAT2WASM) $< -o $@
# Compile a single .go source file into the corresponding .wasm
%.wasm : %.go
@GOOS=js GOARCH=wasm $(GO) build -o $@ $<
.PHONY: clean
clean:
@rm -f $(DWASM) $(SAMPLES_WASM)
@$(GO) clean
.PHONY: test
test:
@$(GO) test -v -cover wasm
.PHONY: vet
vet:
@$(GO) vet