-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (32 loc) · 1.06 KB
/
Copy pathMakefile
File metadata and controls
39 lines (32 loc) · 1.06 KB
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
.DEFAULT_GOAL := help
# Go vars.
GOPRIVATE := github.com/flyingdice
GOPATH ?= $(shell go env GOPATH)
GOBIN ?= $(GOPATH)/bin
GOROOT ?= $(shell tinygo info | grep GOROOT | cut -d ' ' -f 7)
# Project vars.
VERSION ?= $(shell git describe --tags)
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
.PHONY: clean
clean: $(wildcard examples/*) ## Build all examples.
@for e in $^; do \
rm -rf $(ROOT_DIR)/build/$$e/$$(basename $$e).wasm ; \
done;
.PHONY: build
build: $(wildcard examples/*) ## Build all examples.
@for e in $^ ; do \
mkdir -p $(ROOT_DIR)/build/$$e ; \
cd $$e ; \
tinygo build -target wasi -o $(ROOT_DIR)/build/$$e/$$(basename $$e).wasm ; \
cd $(ROOT_DIR) ; \
done; \
.PHONY: lint
lint: ## Run golang linter.
@golangci-lint run
.PHONY: modules
modules: ## Tidy up and vendor go modules.
@GOPRIVATE=$(GOPRIVATE) go mod tidy
@GOPRIVATE=$(GOPRIVATE) go mod vendor
.PHONY: help
help: ## Print Makefile usage.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)