2020-10-27 12:15:52 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
|
|
|
SHELL=bash
|
2022-10-17 18:58:50 +00:00
|
|
|
# GOBIN is used only to install neo-go and allows to override
|
|
|
|
# the location of written binary.
|
|
|
|
export GOBIN ?= $(shell pwd)/bin
|
2021-11-23 09:42:31 +00:00
|
|
|
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
|
2023-11-07 12:23:14 +00:00
|
|
|
morph_sc = balance container frostfsid netmap proxy policy
|
2023-01-09 11:22:59 +00:00
|
|
|
mainnet_sc = frostfs processing
|
2021-07-22 09:46:38 +00:00
|
|
|
nns_sc = nns
|
2023-10-24 16:51:22 +00:00
|
|
|
all_sc = $(alphabet_sc) $(morph_sc) $(mainnet_sc) $(nns_sc)
|
2020-10-27 12:15:52 +00:00
|
|
|
|
|
|
|
define sc_template
|
2023-11-28 11:21:40 +00:00
|
|
|
$(2)$(1)/$(1)_contract.nef: $(2)$(1)/$(1)_contract.go $(2)$(1)/config.yml
|
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
|
|
|
|
|
2023-10-24 16:51:22 +00:00
|
|
|
generate-wrapper.%:
|
|
|
|
@mkdir -p ./rpcclient/$*
|
|
|
|
@# Note, that bindings file is currently missing: is can be emitted by compiler,
|
|
|
|
@# but this leads to a large amount of code duplication. It can be written by hand,
|
|
|
|
@# in case we need to override the type of some variables.
|
|
|
|
@# --config $*/$*.bindings.yml
|
|
|
|
@# Unfortunately, primitive integer types are not yet supported.
|
2024-09-09 06:29:41 +00:00
|
|
|
@# When changing auto-generated path, don't forget to change .gitattributes too.
|
2023-10-24 16:51:22 +00:00
|
|
|
$(NEOGO) contract generate-rpcwrapper --manifest=$*/config.json --out ./rpcclient/$*/client.go
|
|
|
|
|
|
|
|
generate-wrappers: build $(foreach sc,$(all_sc),generate-wrapper.$(sc))
|
|
|
|
|
2021-10-04 12:08:37 +00:00
|
|
|
test:
|
|
|
|
@go test ./tests/...
|
|
|
|
|
2023-11-07 12:00:02 +00:00
|
|
|
# Run all code formatters
|
|
|
|
fmts: fumpt imports
|
|
|
|
|
|
|
|
# Reformat imports
|
|
|
|
imports:
|
|
|
|
@echo "⇒ Processing goimports check"
|
|
|
|
@goimports -w $(all_sc) tests/
|
|
|
|
|
|
|
|
fumpt:
|
|
|
|
@echo "⇒ Processing gofumpt check"
|
|
|
|
@gofumpt -l -w $(all_sc) tests/
|
|
|
|
|
2020-10-27 12:15:52 +00:00
|
|
|
clean:
|
|
|
|
find . -name '*.nef' -exec rm -rf {} \;
|
|
|
|
find . -name 'config.json' -exec rm -rf {} \;
|
2022-10-17 18:58:50 +00:00
|
|
|
rm -rf ./bin/
|
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
|
2023-01-11 07:50:55 +00:00
|
|
|
@tar --transform "s|^./|frostfs-contract-$(VERSION)/|" \
|
|
|
|
-czf frostfs-contract-$(VERSION).tar.gz \
|
2021-07-29 15:09:24 +00:00
|
|
|
$(shell find . -name '*.nef' -o -name 'config.json')
|
2022-10-31 15:48:26 +00:00
|
|
|
|
|
|
|
# Package for Debian
|
|
|
|
debpackage:
|
|
|
|
dch --package frostfs-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
|