Skip to content

Commit

Permalink
Add Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
knqyf263 committed Aug 27, 2022
1 parent ada9224 commit 1ebeeca
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
go_sources := $(shell find cmd encoding gen genid version wasm -name "*.go")

.PHONY: build
build: $(GOPATH)/bin/protoc-gen-go-plugin

$(GOPATH)/bin/protoc-gen-go-plugin: $(go_sources)
go build -o $(GOPATH)/bin/protoc-gen-go-plugin cmd/protoc-gen-go-plugin/main.go

tinygo_examples := $(shell find examples -path "*/plugin*/*.go")
.PHONY: build.examples
build.examples: $(tinygo_examples:.go=.wasm)

%.wasm: %.go
tinygo build -o $@ -scheduler=none --no-debug --target=wasi $<

proto_files := $(shell find . -name "*.proto")
.PHONY: protoc
protoc: $(proto_files:.proto=.pb.go) $(proto_files:.proto=_vtproto.pb.go)

%.pb.go: %.proto $(GOPATH)/bin/protoc-gen-go-plugin
protoc --go-plugin_out=. --go-plugin_opt=paths=source_relative $<;

.PHONY: fmt
fmt: $(proto_files)
@for f in $^; do \
clang-format -i $$f; \
done

0 comments on commit 1ebeeca

Please sign in to comment.