2019-02-01 17:02:52 +00:00
|
|
|
.PHONY: statusgo statusd-prune all test clean help
|
2016-07-20 06:42:19 +00:00
|
|
|
.PHONY: statusgo-android statusgo-ios
|
|
|
|
|
2024-04-26 15:26:36 +00:00
|
|
|
# Clear any GOROOT set outside of the Nix shell
|
|
|
|
export GOROOT=
|
|
|
|
|
2023-11-23 14:55:13 +00:00
|
|
|
# This is a code for automatic help generator.
|
|
|
|
# It supports ANSI colors and categories.
|
|
|
|
# To add new item into help output, simply add comments
|
|
|
|
# starting with '##'. To add category, use @category.
|
|
|
|
GREEN := $(shell echo "\e[32m")
|
|
|
|
WHITE := $(shell echo "\e[37m")
|
|
|
|
YELLOW := $(shell echo "\e[33m")
|
|
|
|
RESET := $(shell echo "\e[0m")
|
|
|
|
HELP_FUN = \
|
|
|
|
%help; \
|
|
|
|
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z0-9\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
|
|
|
|
print "Usage: make [target]\n\n"; \
|
|
|
|
for (sort keys %help) { \
|
|
|
|
print "${WHITE}$$_:${RESET}\n"; \
|
|
|
|
for (@{$$help{$$_}}) { \
|
|
|
|
$$sep = " " x (32 - length $$_->[0]); \
|
|
|
|
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
|
|
|
|
}; \
|
|
|
|
print "\n"; \
|
|
|
|
}
|
|
|
|
|
|
|
|
help: SHELL := /bin/sh
|
|
|
|
help: ##@other Show this help
|
|
|
|
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
|
|
|
|
|
2024-08-19 15:47:11 +00:00
|
|
|
RELEASE_TAG:=$(shell ./_assets/scripts/version.sh)
|
2019-04-12 10:50:14 +00:00
|
|
|
RELEASE_DIR := /tmp/release-$(RELEASE_TAG)
|
2019-06-13 10:24:28 +00:00
|
|
|
GOLANGCI_BINARY=golangci-lint
|
2022-08-11 14:27:25 +00:00
|
|
|
IPFS_GATEWAY_URL ?= https://ipfs.status.im/
|
2018-11-05 14:02:16 +00:00
|
|
|
|
2020-08-06 21:11:53 +00:00
|
|
|
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
|
|
|
|
detected_OS := Windows
|
|
|
|
else
|
|
|
|
detected_OS := $(strip $(shell uname))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(detected_OS),Darwin)
|
|
|
|
GOBIN_SHARED_LIB_EXT := dylib
|
2023-01-25 13:59:54 +00:00
|
|
|
GOBIN_SHARED_LIB_CFLAGS := CGO_ENABLED=1 GOOS=darwin
|
2020-08-06 21:11:53 +00:00
|
|
|
else ifeq ($(detected_OS),Windows)
|
|
|
|
GOBIN_SHARED_LIB_EXT := dll
|
2023-01-25 13:59:54 +00:00
|
|
|
GOBIN_SHARED_LIB_CGO_LDFLAGS := CGO_LDFLAGS=""
|
2020-08-06 21:11:53 +00:00
|
|
|
else
|
|
|
|
GOBIN_SHARED_LIB_EXT := so
|
2021-09-19 14:25:47 +00:00
|
|
|
GOBIN_SHARED_LIB_CGO_LDFLAGS := CGO_LDFLAGS="-Wl,-soname,libstatus.so.0"
|
2020-08-06 21:11:53 +00:00
|
|
|
endif
|
|
|
|
|
2018-08-24 10:25:07 +00:00
|
|
|
CGO_CFLAGS = -I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin
|
2023-11-23 14:55:13 +00:00
|
|
|
export GOPATH ?= $(HOME)/go
|
2023-11-20 08:34:59 +00:00
|
|
|
|
|
|
|
GIT_ROOT := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
2024-06-04 08:22:26 +00:00
|
|
|
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
|
|
|
GIT_AUTHOR := $(shell git config user.email || echo $$USER)
|
2018-03-01 16:18:12 +00:00
|
|
|
|
2018-12-14 11:16:45 +00:00
|
|
|
ENABLE_METRICS ?= true
|
2023-09-13 10:50:23 +00:00
|
|
|
BUILD_TAGS ?= gowaku_no_rln
|
2024-06-04 16:57:19 +00:00
|
|
|
|
|
|
|
BUILD_FLAGS ?= -ldflags="-X github.com/status-im/status-go/params.Version=$(RELEASE_TAG:v%=%) \
|
2018-11-20 10:13:42 +00:00
|
|
|
-X github.com/status-im/status-go/params.GitCommit=$(GIT_COMMIT) \
|
2022-08-11 14:27:25 +00:00
|
|
|
-X github.com/status-im/status-go/params.IpfsGatewayURL=$(IPFS_GATEWAY_URL) \
|
2023-11-23 14:55:13 +00:00
|
|
|
-X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=$(ENABLE_METRICS)"
|
2022-11-04 13:56:45 +00:00
|
|
|
|
2024-06-04 16:57:19 +00:00
|
|
|
BUILD_FLAGS_MOBILE ?= -ldflags="-X github.com/status-im/status-go/params.Version=$(RELEASE_TAG:v%=%) \
|
2022-08-11 14:27:25 +00:00
|
|
|
-X github.com/status-im/status-go/params.GitCommit=$(GIT_COMMIT) \
|
2023-11-23 14:55:13 +00:00
|
|
|
-X github.com/status-im/status-go/params.IpfsGatewayURL=$(IPFS_GATEWAY_URL)"
|
2018-03-15 11:36:28 +00:00
|
|
|
|
|
|
|
networkid ?= StatusChain
|
|
|
|
|
2018-02-26 18:36:04 +00:00
|
|
|
DOCKER_IMAGE_NAME ?= statusteam/status-go
|
2018-05-18 13:43:07 +00:00
|
|
|
BOOTNODE_IMAGE_NAME ?= statusteam/bootnode
|
2018-06-07 10:30:18 +00:00
|
|
|
STATUSD_PRUNE_IMAGE_NAME ?= statusteam/statusd-prune
|
2018-01-03 18:50:19 +00:00
|
|
|
|
2018-11-20 10:13:42 +00:00
|
|
|
DOCKER_IMAGE_CUSTOM_TAG ?= $(RELEASE_TAG)
|
2018-07-02 16:27:59 +00:00
|
|
|
|
2018-02-19 15:32:58 +00:00
|
|
|
DOCKER_TEST_WORKDIR = /go/src/github.com/status-im/status-go/
|
2019-10-05 14:27:48 +00:00
|
|
|
DOCKER_TEST_IMAGE = golang:1.13
|
2018-02-19 15:32:58 +00:00
|
|
|
|
2023-04-26 18:12:04 +00:00
|
|
|
GO_CMD_PATHS := $(filter-out library, $(wildcard cmd/*))
|
|
|
|
GO_CMD_NAMES := $(notdir $(GO_CMD_PATHS))
|
|
|
|
GO_CMD_BUILDS := $(addprefix build/bin/, $(GO_CMD_NAMES))
|
|
|
|
|
2023-11-23 14:55:13 +00:00
|
|
|
# Our custom config is located in nix/nix.conf
|
|
|
|
export NIX_USER_CONF_FILES = $(PWD)/nix/nix.conf
|
|
|
|
# Location of symlinks to derivations that should not be garbage collected
|
|
|
|
export _NIX_GCROOTS = ./.nix-gcroots
|
|
|
|
|
|
|
|
#----------------
|
|
|
|
# Nix targets
|
|
|
|
#----------------
|
|
|
|
|
|
|
|
# Use $(call sh, <COMMAND>) instead of $(shell <COMMAND>) to avoid
|
|
|
|
# invoking a Nix shell when normal shell will suffice, it's faster.
|
|
|
|
# This works because it's defined before we set SHELL to Nix one.
|
|
|
|
define sh
|
|
|
|
$(shell $(1))
|
|
|
|
endef
|
|
|
|
|
2024-04-11 13:23:47 +00:00
|
|
|
# TODO: Define more specific shells.
|
|
|
|
TARGET := default
|
2024-05-07 12:02:38 +00:00
|
|
|
ifneq ($(detected_OS),Windows)
|
|
|
|
SHELL := ./nix/scripts/shell.sh
|
|
|
|
endif
|
2023-11-23 14:55:13 +00:00
|
|
|
shell: export TARGET ?= default
|
|
|
|
shell: ##@prepare Enter into a pre-configured shell
|
|
|
|
ifndef IN_NIX_SHELL
|
|
|
|
@ENTER_NIX_SHELL
|
|
|
|
else
|
|
|
|
@echo "${YELLOW}Nix shell is already active$(RESET)"
|
|
|
|
endif
|
|
|
|
|
|
|
|
nix-repl: SHELL := /bin/sh
|
|
|
|
nix-repl: ##@nix Start an interactive Nix REPL
|
|
|
|
nix repl shell.nix
|
|
|
|
|
|
|
|
nix-gc-protected: SHELL := /bin/sh
|
|
|
|
nix-gc-protected:
|
|
|
|
@echo -e "$(YELLOW)The following paths are protected:$(RESET)" && \
|
|
|
|
ls -1 $(_NIX_GCROOTS) | sed 's/^/ - /'
|
|
|
|
|
|
|
|
|
|
|
|
nix-upgrade: SHELL := /bin/sh
|
|
|
|
nix-upgrade: ##@nix Upgrade Nix interpreter to current version.
|
|
|
|
nix/scripts/upgrade.sh
|
|
|
|
|
|
|
|
nix-gc: nix-gc-protected ##@nix Garbage collect all packages older than 20 days from /nix/store
|
|
|
|
nix-store --gc
|
|
|
|
|
|
|
|
nix-clean: ##@nix Remove all status-mobile build artifacts from /nix/store
|
|
|
|
nix/scripts/clean.sh
|
|
|
|
|
|
|
|
nix-purge: SHELL := /bin/sh
|
|
|
|
nix-purge: ##@nix Completely remove Nix setup, including /nix directory
|
|
|
|
nix/scripts/purge.sh
|
|
|
|
|
|
|
|
#----------------
|
|
|
|
# General targets
|
|
|
|
#----------------
|
2023-04-26 18:12:04 +00:00
|
|
|
all: $(GO_CMD_NAMES)
|
|
|
|
|
|
|
|
.PHONY: $(GO_CMD_NAMES) $(GO_CMD_PATHS) $(GO_CMD_BUILDS)
|
2024-10-03 19:59:44 +00:00
|
|
|
$(GO_CMD_BUILDS): generate
|
2023-04-26 18:12:04 +00:00
|
|
|
$(GO_CMD_BUILDS): ##@build Build any Go project from cmd folder
|
2022-07-26 10:45:48 +00:00
|
|
|
go build -mod=vendor -v \
|
2021-09-13 09:01:29 +00:00
|
|
|
-tags '$(BUILD_TAGS)' $(BUILD_FLAGS) \
|
2023-11-23 14:55:13 +00:00
|
|
|
-o ./$@ ./cmd/$(notdir $@) ;\
|
|
|
|
echo "Compilation done." ;\
|
|
|
|
echo "Run \"build/bin/$(notdir $@) -h\" to view available commands."
|
2023-04-26 18:12:04 +00:00
|
|
|
|
|
|
|
bootnode: ##@build Build discovery v5 bootnode using status-go deps
|
|
|
|
bootnode: build/bin/bootnode
|
|
|
|
|
|
|
|
node-canary: ##@build Build P2P node canary using status-go deps
|
2024-10-03 19:59:44 +00:00
|
|
|
node-canary: generate
|
2023-04-26 18:12:04 +00:00
|
|
|
node-canary: build/bin/node-canary
|
|
|
|
|
|
|
|
statusgo: ##@build Build status-go as statusd server
|
|
|
|
statusgo: build/bin/statusd
|
|
|
|
statusd: statusgo
|
2017-11-03 22:07:13 +00:00
|
|
|
|
2018-06-07 10:30:18 +00:00
|
|
|
statusd-prune: ##@statusd-prune Build statusd-prune
|
2023-04-26 18:12:04 +00:00
|
|
|
statusd-prune: build/bin/statusd-prune
|
|
|
|
|
|
|
|
spiff-workflow: ##@build Build node for SpiffWorkflow BPMN software
|
|
|
|
spiff-workflow: build/bin/spiff-workflow
|
2018-06-07 10:30:18 +00:00
|
|
|
|
2024-03-19 00:31:35 +00:00
|
|
|
status-cli: ##@build Build status-cli to send messages
|
|
|
|
status-cli: build/bin/status-cli
|
|
|
|
|
2024-09-27 15:02:18 +00:00
|
|
|
status-backend: ##@build Build status-backend to run status-go as HTTP server
|
|
|
|
status-backend: build/bin/status-backend
|
|
|
|
|
|
|
|
run-status-backend: PORT ?= 0
|
|
|
|
run-status-backend: ##@run Start status-backend server listening to localhost:PORT
|
|
|
|
go run ./cmd/status-backend --address localhost:${PORT}
|
|
|
|
|
2023-11-23 14:55:13 +00:00
|
|
|
statusd-prune-docker-image: SHELL := /bin/sh
|
2018-06-07 10:30:18 +00:00
|
|
|
statusd-prune-docker-image: ##@statusd-prune Build statusd-prune docker image
|
2018-08-24 10:25:07 +00:00
|
|
|
@echo "Building docker image for ststusd-prune..."
|
|
|
|
docker build --file _assets/build/Dockerfile-prune . \
|
|
|
|
--label "commit=$(GIT_COMMIT)" \
|
2023-11-20 08:34:59 +00:00
|
|
|
--label "author=$(GIT_AUTHOR)" \
|
2018-08-24 10:25:07 +00:00
|
|
|
-t $(BOOTNODE_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG) \
|
|
|
|
-t $(STATUSD_PRUNE_IMAGE_NAME):latest
|
2018-06-07 10:30:18 +00:00
|
|
|
|
2016-07-20 06:42:19 +00:00
|
|
|
statusgo-cross: statusgo-android statusgo-ios
|
2016-10-13 11:46:54 +00:00
|
|
|
@echo "Full cross compilation done."
|
2023-04-26 18:12:04 +00:00
|
|
|
@ls -ld build/bin/statusgo-*
|
2016-07-20 06:42:19 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
statusgo-android: generate
|
2019-02-01 17:02:52 +00:00
|
|
|
statusgo-android: ##@cross-compile Build status-go for Android
|
|
|
|
@echo "Building status-go for Android..."
|
2021-09-13 09:04:00 +00:00
|
|
|
export GO111MODULE=off; \
|
|
|
|
gomobile init; \
|
2021-09-13 09:01:29 +00:00
|
|
|
gomobile bind -v \
|
|
|
|
-target=android -ldflags="-s -w" \
|
2024-06-05 11:53:09 +00:00
|
|
|
-tags '$(BUILD_TAGS) disable_torrent' \
|
2021-09-13 09:01:29 +00:00
|
|
|
$(BUILD_FLAGS_MOBILE) \
|
2024-09-19 03:54:15 +00:00
|
|
|
--androidapi="23" \
|
2021-09-13 09:01:29 +00:00
|
|
|
-o build/bin/statusgo.aar \
|
|
|
|
github.com/status-im/status-go/mobile
|
2019-02-01 17:02:52 +00:00
|
|
|
@echo "Android cross compilation done in build/bin/statusgo.aar"
|
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
statusgo-ios: generate
|
2019-02-01 17:02:52 +00:00
|
|
|
statusgo-ios: ##@cross-compile Build status-go for iOS
|
|
|
|
@echo "Building status-go for iOS..."
|
2021-09-13 09:04:00 +00:00
|
|
|
export GO111MODULE=off; \
|
|
|
|
gomobile init; \
|
2021-09-13 09:01:29 +00:00
|
|
|
gomobile bind -v \
|
|
|
|
-target=ios -ldflags="-s -w" \
|
2024-06-05 11:53:09 +00:00
|
|
|
-tags 'nowatchdog $(BUILD_TAGS) disable_torrent' \
|
2021-09-13 09:01:29 +00:00
|
|
|
$(BUILD_FLAGS_MOBILE) \
|
2022-12-02 18:03:35 +00:00
|
|
|
-o build/bin/Statusgo.xcframework \
|
2021-09-13 09:01:29 +00:00
|
|
|
github.com/status-im/status-go/mobile
|
2022-12-02 18:03:35 +00:00
|
|
|
@echo "iOS framework cross compilation done in build/bin/Statusgo.xcframework"
|
2019-02-01 17:02:52 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
statusgo-library: generate
|
2017-11-29 21:30:16 +00:00
|
|
|
statusgo-library: ##@cross-compile Build status-go as static library for current platform
|
2020-06-03 06:22:05 +00:00
|
|
|
## cmd/library/README.md explains the magic incantation behind this
|
2023-04-26 18:12:04 +00:00
|
|
|
mkdir -p build/bin/statusgo-lib
|
|
|
|
go run cmd/library/*.go > build/bin/statusgo-lib/main.go
|
2017-11-29 21:30:16 +00:00
|
|
|
@echo "Building static library..."
|
2021-09-13 09:01:29 +00:00
|
|
|
go build \
|
2022-11-04 13:56:45 +00:00
|
|
|
-tags '$(BUILD_TAGS)' \
|
2021-09-13 09:01:29 +00:00
|
|
|
$(BUILD_FLAGS) \
|
|
|
|
-buildmode=c-archive \
|
2023-04-26 18:12:04 +00:00
|
|
|
-o build/bin/libstatus.a \
|
|
|
|
./build/bin/statusgo-lib
|
2017-11-29 21:30:16 +00:00
|
|
|
@echo "Static library built:"
|
2023-04-26 18:12:04 +00:00
|
|
|
@ls -la build/bin/libstatus.*
|
2017-11-29 21:30:16 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
statusgo-shared-library: generate
|
2020-08-06 21:11:53 +00:00
|
|
|
statusgo-shared-library: ##@cross-compile Build status-go as shared library for current platform
|
|
|
|
## cmd/library/README.md explains the magic incantation behind this
|
2023-04-26 18:12:04 +00:00
|
|
|
mkdir -p build/bin/statusgo-lib
|
|
|
|
go run cmd/library/*.go > build/bin/statusgo-lib/main.go
|
2020-08-06 21:11:53 +00:00
|
|
|
@echo "Building shared library..."
|
2022-10-31 15:52:21 +00:00
|
|
|
@echo "Tags: $(BUILD_TAGS)"
|
2021-09-28 19:14:52 +00:00
|
|
|
$(GOBIN_SHARED_LIB_CFLAGS) $(GOBIN_SHARED_LIB_CGO_LDFLAGS) go build \
|
2022-11-04 13:56:45 +00:00
|
|
|
-tags '$(BUILD_TAGS)' \
|
2021-09-13 09:01:29 +00:00
|
|
|
$(BUILD_FLAGS) \
|
|
|
|
-buildmode=c-shared \
|
2023-04-26 18:12:04 +00:00
|
|
|
-o build/bin/libstatus.$(GOBIN_SHARED_LIB_EXT) \
|
|
|
|
./build/bin/statusgo-lib
|
2021-09-19 14:25:47 +00:00
|
|
|
ifeq ($(detected_OS),Linux)
|
2023-04-26 18:12:04 +00:00
|
|
|
cd build/bin && \
|
2021-09-19 14:25:47 +00:00
|
|
|
ls -lah . && \
|
|
|
|
mv ./libstatus.$(GOBIN_SHARED_LIB_EXT) ./libstatus.$(GOBIN_SHARED_LIB_EXT).0 && \
|
|
|
|
ln -s ./libstatus.$(GOBIN_SHARED_LIB_EXT).0 ./libstatus.$(GOBIN_SHARED_LIB_EXT)
|
|
|
|
endif
|
2020-08-06 21:11:53 +00:00
|
|
|
@echo "Shared library built:"
|
2023-04-26 18:12:04 +00:00
|
|
|
@ls -la build/bin/libstatus.*
|
2020-08-06 21:11:53 +00:00
|
|
|
|
2023-11-23 14:55:13 +00:00
|
|
|
docker-image: SHELL := /bin/sh
|
2023-04-26 18:17:16 +00:00
|
|
|
docker-image: BUILD_TARGET ?= statusd
|
2018-01-03 18:50:19 +00:00
|
|
|
docker-image: ##@docker Build docker image (use DOCKER_IMAGE_NAME to set the image name)
|
|
|
|
@echo "Building docker image..."
|
2018-07-02 16:27:59 +00:00
|
|
|
docker build --file _assets/build/Dockerfile . \
|
2023-11-23 14:55:13 +00:00
|
|
|
--build-arg 'build_tags=$(BUILD_TAGS)' \
|
|
|
|
--build-arg 'build_flags=$(BUILD_FLAGS)' \
|
|
|
|
--build-arg 'build_target=$(BUILD_TARGET)' \
|
|
|
|
--label 'commit=$(GIT_COMMIT)' \
|
|
|
|
--label 'author=$(GIT_AUTHOR)' \
|
2021-01-26 17:12:24 +00:00
|
|
|
-t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG) \
|
2018-07-02 16:27:59 +00:00
|
|
|
-t $(DOCKER_IMAGE_NAME):latest
|
2018-02-12 20:56:53 +00:00
|
|
|
|
2023-11-23 14:55:13 +00:00
|
|
|
bootnode-image: SHELL := /bin/sh
|
2018-05-18 13:43:07 +00:00
|
|
|
bootnode-image:
|
|
|
|
@echo "Building docker image for bootnode..."
|
2018-07-02 16:27:59 +00:00
|
|
|
docker build --file _assets/build/Dockerfile-bootnode . \
|
2023-11-23 14:55:13 +00:00
|
|
|
--build-arg 'build_tags=$(BUILD_TAGS)' \
|
|
|
|
--build-arg 'build_flags=$(BUILD_FLAGS)' \
|
|
|
|
--label 'commit=$(GIT_COMMIT)' \
|
|
|
|
--label 'author=$(GIT_AUTHOR)' \
|
2021-01-26 17:12:24 +00:00
|
|
|
-t $(BOOTNODE_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG) \
|
2018-07-02 16:27:59 +00:00
|
|
|
-t $(BOOTNODE_IMAGE_NAME):latest
|
|
|
|
|
2023-11-23 14:55:13 +00:00
|
|
|
push-docker-images: SHELL := /bin/sh
|
2018-07-02 16:27:59 +00:00
|
|
|
push-docker-images: docker-image bootnode-image
|
|
|
|
docker push $(BOOTNODE_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG)
|
|
|
|
docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG)
|
|
|
|
|
2023-11-23 14:55:13 +00:00
|
|
|
clean-docker-images: SHELL := /bin/sh
|
2019-03-25 10:35:38 +00:00
|
|
|
clean-docker-images:
|
2023-11-23 14:55:13 +00:00
|
|
|
docker rmi -f $$(docker image ls --filter="reference=$(DOCKER_IMAGE_NAME)" --quiet)
|
2019-03-25 10:35:38 +00:00
|
|
|
|
2018-08-02 17:16:39 +00:00
|
|
|
# See https://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html to understand this magic.
|
2023-11-23 14:55:13 +00:00
|
|
|
push-docker-images-latest: SHELL := /bin/sh
|
2018-08-02 17:16:39 +00:00
|
|
|
push-docker-images-latest: GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
push-docker-images-latest: GIT_LOCAL = $(shell git rev-parse @)
|
|
|
|
push-docker-images-latest: GIT_REMOTE = $(shell git fetch -q && git rev-parse remotes/origin/develop || echo 'NO_DEVELOP')
|
2023-11-23 14:55:13 +00:00
|
|
|
push-docker-images-latest:
|
|
|
|
echo $(GIT_BRANCH)
|
|
|
|
echo $(GIT_LOCAL)
|
|
|
|
echo $(GIT_REMOTE)
|
2018-08-02 17:16:39 +00:00
|
|
|
@echo "Pushing latest docker images..."
|
|
|
|
@echo "Checking git branch..."
|
2018-07-02 16:27:59 +00:00
|
|
|
ifneq ("$(GIT_BRANCH)", "develop")
|
2018-08-02 17:16:39 +00:00
|
|
|
$(error You should only use develop branch to push the latest tag!)
|
2018-07-02 16:27:59 +00:00
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
ifneq ("$(GIT_LOCAL)", "$(GIT_REMOTE)")
|
2018-08-02 17:16:39 +00:00
|
|
|
$(error The local git commit does not match the remote origin!)
|
2018-07-02 16:27:59 +00:00
|
|
|
exit 1
|
|
|
|
endif
|
2021-01-26 17:12:24 +00:00
|
|
|
docker push $(BOOTNODE_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG)
|
|
|
|
docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG)
|
2018-01-03 18:50:19 +00:00
|
|
|
|
2021-09-13 09:04:00 +00:00
|
|
|
setup: ##@setup Install all tools
|
2023-11-23 14:55:13 +00:00
|
|
|
setup: setup-dev
|
2021-09-13 09:04:00 +00:00
|
|
|
|
|
|
|
setup-dev: ##@setup Install all necessary tools for development
|
2023-11-23 14:55:13 +00:00
|
|
|
setup-dev:
|
|
|
|
echo "Replaced by Nix shell. Use 'make shell' or just any target as-is."
|
2018-09-13 16:31:29 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
generate: PACKAGES ?= $$(go list -e ./... | grep -v "/contracts/")
|
|
|
|
generate: GO_GENERATE_CMD ?= $$(which go-generate-fast || echo 'go generate')
|
|
|
|
generate: export GO_GENERATE_FAST_DEBUG ?= false
|
|
|
|
generate: export GO_GENERATE_FAST_RECACHE ?= false
|
|
|
|
generate: ##@ Run generate for all given packages using go-generate-fast, fallback to `go generate` (e.g. for docker)
|
|
|
|
@GOROOT=$$(go env GOROOT) $(GO_GENERATE_CMD) -x $(PACKAGES)
|
2024-06-21 15:20:54 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
generate-contracts:
|
|
|
|
go generate ./contracts
|
2024-10-01 09:20:03 +00:00
|
|
|
download-uniswap-tokens:
|
|
|
|
go run ./services/wallet/token/downloader/main.go
|
|
|
|
|
2018-11-05 14:02:16 +00:00
|
|
|
prepare-release: clean-release
|
2019-04-12 10:50:14 +00:00
|
|
|
mkdir -p $(RELEASE_DIR)
|
|
|
|
mv build/bin/statusgo.aar $(RELEASE_DIR)/status-go-android.aar
|
2022-12-02 18:03:35 +00:00
|
|
|
zip -r build/bin/Statusgo.xcframework.zip build/bin/Statusgo.xcframework
|
|
|
|
mv build/bin/Statusgo.xcframework.zip $(RELEASE_DIR)/status-go-ios.zip
|
2019-04-12 10:50:14 +00:00
|
|
|
zip -r $(RELEASE_DIR)/status-go-desktop.zip . -x *.git*
|
2018-12-06 12:22:18 +00:00
|
|
|
${MAKE} clean
|
2018-11-05 14:02:16 +00:00
|
|
|
|
|
|
|
clean-release:
|
2019-04-12 10:50:14 +00:00
|
|
|
rm -rf $(RELEASE_DIR)
|
2018-11-05 14:02:16 +00:00
|
|
|
|
2020-01-07 13:53:13 +00:00
|
|
|
lint-fix:
|
2020-02-10 16:52:43 +00:00
|
|
|
find . \
|
|
|
|
-name '*.go' \
|
|
|
|
-and -not -name '*.pb.go' \
|
|
|
|
-and -not -name 'bindata*' \
|
|
|
|
-and -not -name 'migrations.go' \
|
2023-10-24 03:42:56 +00:00
|
|
|
-and -not -name 'messenger_handlers.go' \
|
2024-10-03 19:59:44 +00:00
|
|
|
-and -not -name '*/mock/*' \
|
|
|
|
-and -not -name 'mock.go' \
|
2020-02-10 16:52:43 +00:00
|
|
|
-and -not -wholename '*/vendor/*' \
|
|
|
|
-exec goimports \
|
|
|
|
-local 'github.com/ethereum/go-ethereum,github.com/status-im/status-go,github.com/status-im/markdown' \
|
|
|
|
-w {} \;
|
2020-01-02 09:10:19 +00:00
|
|
|
$(MAKE) vendor
|
2019-12-30 10:29:04 +00:00
|
|
|
|
2018-02-19 15:32:58 +00:00
|
|
|
docker-test: ##@tests Run tests in a docker container with golang.
|
2023-11-23 14:55:13 +00:00
|
|
|
docker run --privileged --rm -it -v "$(PWD):$(DOCKER_TEST_WORKDIR)" -w "$(DOCKER_TEST_WORKDIR)" $(DOCKER_TEST_IMAGE) go test ${ARGS}
|
2018-02-19 15:32:58 +00:00
|
|
|
|
2018-08-02 17:16:39 +00:00
|
|
|
test: test-unit ##@tests Run basic, short tests during development
|
2017-10-20 10:10:28 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
test-unit: generate
|
2023-08-31 11:43:23 +00:00
|
|
|
test-unit: export BUILD_TAGS ?=
|
2024-09-03 11:50:09 +00:00
|
|
|
test-unit: export UNIT_TEST_DRY_RUN ?= false
|
2024-02-29 07:59:26 +00:00
|
|
|
test-unit: export UNIT_TEST_COUNT ?= 1
|
2023-11-21 15:39:11 +00:00
|
|
|
test-unit: export UNIT_TEST_FAILFAST ?= true
|
2024-02-26 15:04:20 +00:00
|
|
|
test-unit: export UNIT_TEST_RERUN_FAILS ?= true
|
|
|
|
test-unit: export UNIT_TEST_USE_DEVELOPMENT_LOGGER ?= true
|
2024-05-08 08:25:01 +00:00
|
|
|
test-unit: export UNIT_TEST_REPORT_CODECLIMATE ?= false
|
2024-09-05 09:11:16 +00:00
|
|
|
test-unit: export UNIT_TEST_REPORT_CODECOV ?= false
|
2024-09-03 11:50:09 +00:00
|
|
|
test-unit: export UNIT_TEST_PACKAGES ?= $(call sh, go list ./... | \
|
2018-08-02 17:16:39 +00:00
|
|
|
grep -v /vendor | \
|
|
|
|
grep -v /t/e2e | \
|
|
|
|
grep -v /t/benchmarks | \
|
2024-09-03 11:50:09 +00:00
|
|
|
grep -v /transactions/fake)
|
2017-10-20 10:10:28 +00:00
|
|
|
test-unit: ##@tests Run unit and integration tests
|
2023-08-31 11:43:23 +00:00
|
|
|
./_assets/scripts/run_unit_tests.sh
|
|
|
|
|
|
|
|
test-unit-race: export GOTEST_EXTRAFLAGS=-race
|
2018-03-27 12:38:41 +00:00
|
|
|
test-unit-race: test-unit ##@tests Run unit and integration tests with -race flag
|
2017-10-11 14:20:51 +00:00
|
|
|
|
|
|
|
test-e2e: ##@tests Run e2e tests
|
|
|
|
# order: reliability then alphabetical
|
2017-10-23 11:05:52 +00:00
|
|
|
# TODO(tiabc): make a single command out of them adding `-p 1` flag.
|
2018-03-27 12:38:41 +00:00
|
|
|
|
2023-08-31 11:43:23 +00:00
|
|
|
test-e2e-race: export GOTEST_EXTRAFLAGS=-race
|
2018-03-27 15:07:06 +00:00
|
|
|
test-e2e-race: test-e2e ##@tests Run e2e tests with -race flag
|
2017-10-11 14:20:51 +00:00
|
|
|
|
2024-10-03 13:51:51 +00:00
|
|
|
test-functional: export FUNCTIONAL_TESTS_DOCKER_UID ?= $(call sh, id -u)
|
|
|
|
test-functional: export FUNCTIONAL_TESTS_REPORT_CODECOV ?= false
|
|
|
|
test-functional:
|
|
|
|
@./_assets/scripts/run_functional_tests.sh
|
|
|
|
|
2018-11-19 17:12:59 +00:00
|
|
|
canary-test: node-canary
|
2019-02-01 17:02:52 +00:00
|
|
|
# TODO: uncomment that!
|
2020-02-20 13:05:05 +00:00
|
|
|
#_assets/scripts/canary_test_mailservers.sh ./config/cli/fleet-eth.prod.json
|
2018-11-19 17:12:59 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
lint: generate
|
2023-11-23 14:55:13 +00:00
|
|
|
golangci-lint run ./...
|
2018-01-24 08:25:28 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
ci: generate lint canary-test test-unit test-e2e ##@tests Run all linters and tests at once
|
2016-12-07 21:07:08 +00:00
|
|
|
|
2024-10-03 19:59:44 +00:00
|
|
|
ci-race: generate lint canary-test test-unit test-e2e-race ##@tests Run all linters and tests at once + race
|
2019-02-07 12:12:35 +00:00
|
|
|
|
2017-10-03 11:54:19 +00:00
|
|
|
clean: ##@other Cleanup
|
2021-05-14 09:26:16 +00:00
|
|
|
rm -fr build/bin/* mailserver-config.json
|
2023-11-02 17:20:35 +00:00
|
|
|
|
|
|
|
git-clean:
|
2019-11-27 12:22:23 +00:00
|
|
|
git clean -xf
|
2017-11-07 17:46:11 +00:00
|
|
|
|
2023-11-02 17:20:35 +00:00
|
|
|
deep-clean: clean git-clean
|
2017-11-21 14:40:52 +00:00
|
|
|
rm -Rdf .ethereumtest/StatusChain
|
2018-02-01 17:14:51 +00:00
|
|
|
|
2019-06-09 07:24:20 +00:00
|
|
|
tidy:
|
|
|
|
go mod tidy
|
2018-02-01 17:14:51 +00:00
|
|
|
|
2019-06-09 07:24:20 +00:00
|
|
|
vendor:
|
|
|
|
go mod tidy
|
|
|
|
go mod vendor
|
|
|
|
modvendor -copy="**/*.c **/*.h" -v
|
|
|
|
.PHONY: vendor
|
2018-02-09 13:38:18 +00:00
|
|
|
|
2018-09-14 08:46:34 +00:00
|
|
|
update-fleet-config: ##@other Update fleets configuration from fleets.status.im
|
2020-02-20 13:05:05 +00:00
|
|
|
./_assets/scripts/update-fleet-config.sh
|
2018-09-14 08:46:34 +00:00
|
|
|
@echo "Updating static assets..."
|
|
|
|
@go generate ./static
|
|
|
|
@echo "Done"
|
2019-02-06 16:47:01 +00:00
|
|
|
|
2019-11-28 22:52:38 +00:00
|
|
|
run-bootnode-systemd: ##@Easy way to run a bootnode locally with Docker Compose
|
2019-12-09 23:06:44 +00:00
|
|
|
@cd _assets/systemd/bootnode && $(MAKE)
|
2019-11-28 22:52:38 +00:00
|
|
|
|
2019-09-16 09:38:33 +00:00
|
|
|
run-bootnode-docker: ##@Easy way to run a bootnode locally with Docker Compose
|
2019-12-09 23:06:44 +00:00
|
|
|
@cd _assets/compose/bootnode && $(MAKE)
|
2019-03-21 15:46:02 +00:00
|
|
|
|
2019-11-15 09:35:26 +00:00
|
|
|
run-mailserver-systemd: ##@Easy Run a mailserver locally with systemd
|
2019-12-09 23:06:44 +00:00
|
|
|
@cd _assets/systemd/mailserver && $(MAKE)
|
2019-09-16 09:38:33 +00:00
|
|
|
|
2019-11-15 09:35:26 +00:00
|
|
|
run-mailserver-docker: ##@Easy Run a mailserver locally with Docker Compose
|
2019-12-09 23:06:44 +00:00
|
|
|
@cd _assets/compose/mailserver && $(MAKE)
|
|
|
|
|
|
|
|
clean-bootnode-systemd: ##@Easy Clean your systemd service for running a bootnode
|
|
|
|
@cd _assets/systemd/bootnode && $(MAKE) clean
|
|
|
|
|
|
|
|
clean-bootnode-docker: ##@Easy Clean your Docker container running a bootnode
|
|
|
|
@cd _assets/compose/bootnode && $(MAKE) clean
|
2019-11-15 09:35:26 +00:00
|
|
|
|
|
|
|
clean-mailserver-systemd: ##@Easy Clean your systemd service for running a mailserver
|
2019-12-09 23:06:44 +00:00
|
|
|
@cd _assets/systemd/mailserver && $(MAKE) clean
|
2019-11-15 09:35:26 +00:00
|
|
|
|
|
|
|
clean-mailserver-docker: ##@Easy Clean your Docker container running a mailserver
|
2019-12-09 23:06:44 +00:00
|
|
|
@cd _assets/compose/mailserver && $(MAKE) clean
|
2021-04-15 09:44:26 +00:00
|
|
|
|
2021-05-28 11:05:01 +00:00
|
|
|
migration: DEFAULT_MIGRATION_PATH := appdatabase/migrations/sql
|
2021-04-15 09:44:26 +00:00
|
|
|
migration:
|
2023-11-23 14:55:13 +00:00
|
|
|
touch $(DEFAULT_MIGRATION_PATH)/$$(date '+%s')_$(D).up.sql
|
2021-04-16 13:14:21 +00:00
|
|
|
|
2023-06-21 12:21:26 +00:00
|
|
|
migration-check:
|
2024-03-14 13:27:37 +00:00
|
|
|
bash _assets/scripts/migration_check.sh
|
2023-06-21 12:21:26 +00:00
|
|
|
|
2024-08-27 21:42:06 +00:00
|
|
|
commit-check: SHELL := /bin/sh
|
2024-04-08 15:47:44 +00:00
|
|
|
commit-check:
|
2024-08-27 21:42:06 +00:00
|
|
|
@bash _assets/scripts/commit_check.sh
|
2024-04-08 15:47:44 +00:00
|
|
|
|
2024-09-18 09:17:08 +00:00
|
|
|
version: SHELL := /bin/sh
|
|
|
|
version:
|
|
|
|
@./_assets/scripts/version.sh
|
|
|
|
|
2024-04-08 15:47:44 +00:00
|
|
|
tag-version:
|
|
|
|
bash _assets/scripts/tag_version.sh $(TARGET_COMMIT)
|
|
|
|
|
2023-08-11 11:25:14 +00:00
|
|
|
migration-wallet: DEFAULT_WALLET_MIGRATION_PATH := walletdatabase/migrations/sql
|
|
|
|
migration-wallet:
|
2023-11-23 14:55:13 +00:00
|
|
|
touch $(DEFAULT_WALLET_MIGRATION_PATH)/$$(date +%s)_$(D).up.sql
|
2023-08-11 11:25:14 +00:00
|
|
|
|
2024-09-18 09:17:08 +00:00
|
|
|
install-git-hooks: SHELL := /bin/sh
|
2023-06-21 12:21:26 +00:00
|
|
|
install-git-hooks:
|
2023-11-20 08:34:59 +00:00
|
|
|
@ln -sf $(if $(filter $(detected_OS), Linux),-r,) \
|
|
|
|
$(GIT_ROOT)/_assets/hooks/* $(GIT_ROOT)/.git/hooks
|
2023-11-07 16:56:25 +00:00
|
|
|
|
|
|
|
-include install-git-hooks
|
|
|
|
.PHONY: install-git-hooks
|
2023-06-21 12:21:26 +00:00
|
|
|
|
2021-04-16 13:14:21 +00:00
|
|
|
migration-protocol: DEFAULT_PROTOCOL_PATH := protocol/migrations/sqlite
|
|
|
|
migration-protocol:
|
2023-11-23 14:55:13 +00:00
|
|
|
touch $(DEFAULT_PROTOCOL_PATH)/$$(date +%s)_$(D).up.sql
|
2022-10-31 15:52:21 +00:00
|
|
|
|
|
|
|
PROXY_WRAPPER_PATH = $(CURDIR)/vendor/github.com/siphiuel/lc-proxy-wrapper
|
|
|
|
-include $(PROXY_WRAPPER_PATH)/Makefile.vars
|
|
|
|
|
|
|
|
#export VERIF_PROXY_OUT_PATH = $(CURDIR)/vendor/github.com/siphiuel/lc-proxy-wrapper
|
|
|
|
build-verif-proxy:
|
|
|
|
$(MAKE) -C $(NIMBUS_ETH1_PATH) libverifproxy
|
|
|
|
|
|
|
|
build-verif-proxy-wrapper:
|
|
|
|
$(MAKE) -C $(VERIF_PROXY_OUT_PATH) build-verif-proxy-wrapper
|
|
|
|
|
|
|
|
test-verif-proxy-wrapper:
|
|
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" go test -v github.com/status-im/status-go/rpc -tags gowaku_skip_migrations,nimbus_light_client -run ^TestProxySuite$$ -testify.m TestRun -ldflags $(LDFLAGS)
|
2024-06-12 09:47:41 +00:00
|
|
|
|
|
|
|
run-anvil: SHELL := /bin/sh
|
|
|
|
run-anvil:
|
2024-10-03 13:51:51 +00:00
|
|
|
docker-compose -f tests-functional/docker-compose.anvil.yml up --remove-orphans
|
2024-09-05 09:11:16 +00:00
|
|
|
|
2024-09-24 15:33:26 +00:00
|
|
|
codecov-validate: SHELL := /bin/sh
|
2024-09-05 09:11:16 +00:00
|
|
|
codecov-validate:
|
|
|
|
curl -X POST --data-binary @.codecov.yml https://codecov.io/validate
|