2020-10-27 12:15:52 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
|
|
|
SHELL=bash
|
2021-11-23 09:42:31 +00:00
|
|
|
GOBIN ?= $(shell go env GOPATH)/bin
|
|
|
|
NEOGO ?= $(GOBIN)/cli
|
2022-09-06 07:44:30 +00:00
|
|
|
VERSION ?= $(shell git describe --tags --dirty --match "v*" --always --abbrev=8 2>/dev/null || cat VERSION 2>/dev/null || echo "develop")
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2022-10-31 15:48:26 +00:00
|
|
|
|
|
|
|
# .deb package versioning
|
|
|
|
OS_RELEASE = $(shell lsb_release -cs)
|
|
|
|
PKG_VERSION ?= $(shell echo $(VERSION) | sed "s/^v//" | \
|
|
|
|
sed -E "s/(.*)-(g[a-fA-F0-9]{6,8})(.*)/\1\3~\2/" | \
|
|
|
|
sed "s/-/~/")-${OS_RELEASE}
|
|
|
|
|
2021-11-23 09:42:31 +00:00
|
|
|
.PHONY: all build clean test neo-go
|
2021-10-04 12:11:11 +00:00
|
|
|
.PHONY: alphabet mainnet morph nns sidechain
|
2022-10-31 15:48:26 +00:00
|
|
|
.PHONY: debpackage debclean
|
2021-11-23 09:42:31 +00:00
|
|
|
build: neo-go all
|
2020-10-27 12:15:52 +00:00
|
|
|
all: sidechain mainnet
|
2021-07-22 09:46:38 +00:00
|
|
|
sidechain: alphabet morph nns
|
2020-10-27 12:15:52 +00:00
|
|
|
|
2020-12-15 12:19:13 +00:00
|
|
|
alphabet_sc = alphabet
|
2021-11-18 11:31:58 +00:00
|
|
|
morph_sc = audit balance container neofsid netmap proxy reputation subnet
|
2021-04-20 14:40:18 +00:00
|
|
|
mainnet_sc = neofs processing
|
2021-07-22 09:46:38 +00:00
|
|
|
nns_sc = nns
|
2020-10-27 12:15:52 +00:00
|
|
|
|
|
|
|
define sc_template
|
|
|
|
$(2)$(1)/$(1)_contract.nef: $(2)$(1)/$(1)_contract.go
|
2021-07-22 13:12:59 +00:00
|
|
|
$(NEOGO) contract compile -i $(2)$(1) -c $(if $(2),$(2),$(1)/)config.yml -m $(2)$(1)/config.json -o $(2)$(1)/$(1)_contract.nef
|
2020-10-27 12:15:52 +00:00
|
|
|
|
|
|
|
$(if $(2),$(2)$(1)/$(1)_contract.go: alphabet/alphabet.go alphabet/alphabet.tpl
|
|
|
|
go run alphabet/alphabet.go
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2020-12-15 12:19:13 +00:00
|
|
|
$(foreach sc,$(alphabet_sc),$(eval $(call sc_template,$(sc))))
|
2020-10-27 12:15:52 +00:00
|
|
|
$(foreach sc,$(morph_sc),$(eval $(call sc_template,$(sc))))
|
|
|
|
$(foreach sc,$(mainnet_sc),$(eval $(call sc_template,$(sc))))
|
2021-07-22 09:46:38 +00:00
|
|
|
$(foreach sc,$(nns_sc),$(eval $(call sc_template,$(sc))))
|
2020-10-27 12:15:52 +00:00
|
|
|
|
2020-12-15 12:19:13 +00:00
|
|
|
alphabet: $(foreach sc,$(alphabet_sc),$(sc)/$(sc)_contract.nef)
|
2020-10-27 12:15:52 +00:00
|
|
|
morph: $(foreach sc,$(morph_sc),$(sc)/$(sc)_contract.nef)
|
|
|
|
mainnet: $(foreach sc,$(mainnet_sc),$(sc)/$(sc)_contract.nef)
|
2021-07-22 09:46:38 +00:00
|
|
|
nns: $(foreach sc,$(nns_sc),$(sc)/$(sc)_contract.nef)
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2021-11-23 09:42:31 +00:00
|
|
|
neo-go:
|
|
|
|
@go list -f '{{.Path}}/...@{{.Version}}' -m github.com/nspcc-dev/neo-go \
|
|
|
|
| xargs go install -v
|
|
|
|
|
2021-10-04 12:08:37 +00:00
|
|
|
test:
|
|
|
|
@go test ./tests/...
|
|
|
|
|
2020-10-27 12:15:52 +00:00
|
|
|
clean:
|
|
|
|
find . -name '*.nef' -exec rm -rf {} \;
|
|
|
|
find . -name 'config.json' -exec rm -rf {} \;
|
2020-03-30 13:59:54 +00:00
|
|
|
|
2020-10-27 12:15:52 +00:00
|
|
|
mr_proper: clean
|
|
|
|
for sc in $(alphabet_sc); do\
|
|
|
|
rm -rf alphabet/$$sc; \
|
|
|
|
done
|
2021-07-29 15:09:24 +00:00
|
|
|
|
|
|
|
archive: build
|
|
|
|
@tar --transform "s|^./|neofs-contract-$(VERSION)/|" \
|
|
|
|
-czf neofs-contract-$(VERSION).tar.gz \
|
|
|
|
$(shell find . -name '*.nef' -o -name 'config.json')
|
2022-10-31 15:48:26 +00:00
|
|
|
|
|
|
|
# Package for Debian
|
|
|
|
debpackage:
|
|
|
|
dch --package neofs-contract \
|
|
|
|
--controlmaint \
|
|
|
|
--newversion $(PKG_VERSION) \
|
|
|
|
--distribution $(OS_RELEASE) \
|
|
|
|
"Please see CHANGELOG.md for code changes for $(VERSION)"
|
|
|
|
dpkg-buildpackage --no-sign -b
|
|
|
|
|
|
|
|
debclean:
|
|
|
|
dh clean
|