frostfs-contract/Makefile
Evgenii Stratonikov 3723fcaacf [#177] Makefile: build with neo-go from go.mod
Currently compiler version and test/interop version are decoupled.
It would be nice to use the compiler from go.mod by default
as this is the version our contracts are tested on.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-25 11:26:35 +03:00

57 lines
1.7 KiB
Makefile

#!/usr/bin/make -f
SHELL=bash
GOBIN ?= $(shell go env GOPATH)/bin
NEOGO ?= $(GOBIN)/cli
VERSION?=$(shell git describe --tags)
.PHONY: all build clean test neo-go
.PHONY: alphabet mainnet morph nns sidechain
build: neo-go all
all: sidechain mainnet
sidechain: alphabet morph nns
alphabet_sc = alphabet
morph_sc = audit balance container neofsid netmap proxy reputation subnet
mainnet_sc = neofs processing
nns_sc = nns
define sc_template
$(2)$(1)/$(1)_contract.nef: $(2)$(1)/$(1)_contract.go
$(NEOGO) contract compile -i $(2)$(1) -c $(if $(2),$(2),$(1)/)config.yml -m $(2)$(1)/config.json -o $(2)$(1)/$(1)_contract.nef
$(if $(2),$(2)$(1)/$(1)_contract.go: alphabet/alphabet.go alphabet/alphabet.tpl
go run alphabet/alphabet.go
)
endef
$(foreach sc,$(alphabet_sc),$(eval $(call sc_template,$(sc))))
$(foreach sc,$(morph_sc),$(eval $(call sc_template,$(sc))))
$(foreach sc,$(mainnet_sc),$(eval $(call sc_template,$(sc))))
$(foreach sc,$(nns_sc),$(eval $(call sc_template,$(sc))))
alphabet: $(foreach sc,$(alphabet_sc),$(sc)/$(sc)_contract.nef)
morph: $(foreach sc,$(morph_sc),$(sc)/$(sc)_contract.nef)
mainnet: $(foreach sc,$(mainnet_sc),$(sc)/$(sc)_contract.nef)
nns: $(foreach sc,$(nns_sc),$(sc)/$(sc)_contract.nef)
neo-go:
@go list -f '{{.Path}}/...@{{.Version}}' -m github.com/nspcc-dev/neo-go \
| xargs go install -v
test:
@go test ./tests/...
clean:
find . -name '*.nef' -exec rm -rf {} \;
find . -name 'config.json' -exec rm -rf {} \;
mr_proper: clean
for sc in $(alphabet_sc); do\
rm -rf alphabet/$$sc; \
done
archive: build
@tar --transform "s|^./|neofs-contract-$(VERSION)/|" \
-czf neofs-contract-$(VERSION).tar.gz \
$(shell find . -name '*.nef' -o -name 'config.json')