2017-10-03 11:54:19 +00:00
.PHONY : statusgo all test xgo clean help
2016-07-20 06:42:19 +00:00
.PHONY : statusgo -android statusgo -ios
2017-11-03 22:07:13 +00:00
help : ##@other Show this help
@perl -e '$(HELP_FUN)' $( MAKEFILE_LIST)
2017-10-23 10:21:30 +00:00
i n c l u d e . / s t a t i c / t o o l s / m k / l i n t . m k
2017-11-04 04:20:17 +00:00
i f n d e f G O P A T H
$(error GOPATH not set. Please set GOPATH and make sure status-go is located at $$GOPATH/src/github.com/status-im/status-go. For more information about the GOPATH environment variable, see https : //golang .org /doc /code .html #GOPATH)
e n d i f
CGO_CFLAGS = -I/$( JAVA_HOME) /include -I/$( JAVA_HOME) /include/darwin
2016-06-18 18:28:08 +00:00
GOBIN = build/bin
2016-06-17 11:55:54 +00:00
GO ?= latest
2017-10-03 11:54:19 +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 tput -Txterm setaf 2)
WHITE := $( shell tput -Txterm setaf 7)
YELLOW := $( shell tput -Txterm setaf 3)
RESET := $( shell tput -Txterm sgr0)
HELP_FUN = \
%help; \
while ( <>) { push @{ $$ help{ $$ 2 // 'options' } } , [ $$ 1, $$ 3] if /^( [ a-zA-Z\- ] +) \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" ; \
}
# Main targets
2017-11-20 18:21:30 +00:00
UNIT_TEST_PACKAGES := $( shell go list ./... | grep -v /vendor | grep -v /e2e | grep -v /cmd | grep -v /lib)
2017-10-11 14:20:51 +00:00
2017-10-03 11:54:19 +00:00
statusgo : ##@build Build status-go as statusd server
2017-11-04 04:20:17 +00:00
go build -i -o $( GOBIN) /statusd -v $( shell build/testnet-flags.sh) ./cmd/statusd
2017-11-03 22:07:13 +00:00
@echo "\nCompilation done.\nRun \"build/bin/statusd -h\" to view available commands."
wnode-status : ##@build Build wnode-status (Whisper 5 debug tool)
2017-11-04 04:20:17 +00:00
go build -i -o $( GOBIN) /wnode-status -v $( shell build/testnet-flags.sh) ./cmd/wnode-status
2016-06-17 11:55:54 +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."
2016-07-20 06:42:19 +00:00
@ls -ld $( GOBIN) /statusgo-*
2017-10-03 11:54:19 +00:00
statusgo-android : xgo ##@cross-compile Build status-go for Android
2017-11-21 14:40:52 +00:00
$( GOPATH) /bin/xgo --image farazdagi/xgo --go= $( GO) -out statusgo --dest= $( GOBIN) --targets= android-16/aar -v $( shell build/testnet-flags.sh) ./lib
2016-10-13 11:46:54 +00:00
@echo "Android cross compilation done."
2016-06-17 11:55:54 +00:00
2017-10-03 11:54:19 +00:00
statusgo-ios : xgo ##@cross-compile Build status-go for iOS
2017-11-21 14:40:52 +00:00
$( GOPATH) /bin/xgo --image farazdagi/xgo --go= $( GO) -out statusgo --dest= $( GOBIN) --targets= ios-9.3/framework -v $( shell build/testnet-flags.sh) ./lib
2016-10-13 11:46:54 +00:00
@echo "iOS framework cross compilation done."
2016-07-20 06:42:19 +00:00
2017-10-03 11:54:19 +00:00
statusgo-ios-simulator : xgo ##@cross-compile Build status-go for iOS Simulator
2017-11-04 04:20:17 +00:00
@docker pull farazdagi/xgo-ios-simulator
2017-11-21 14:40:52 +00:00
$( GOPATH) /bin/xgo --image farazdagi/xgo-ios-simulator --go= $( GO) -out statusgo --dest= $( GOBIN) --targets= ios-9.3/framework -v $( shell build/testnet-flags.sh) ./lib
2016-10-13 11:46:54 +00:00
@echo "iOS framework cross compilation done."
2016-07-20 06:42:19 +00:00
2016-06-17 11:55:54 +00:00
xgo :
2017-11-04 04:20:17 +00:00
docker pull farazdagi/xgo
go get github.com/karalabe/xgo
2016-07-20 06:42:19 +00:00
2016-10-13 11:46:54 +00:00
statusgo-mainnet :
2017-11-04 04:20:17 +00:00
go build -i -o $( GOBIN) /statusgo -v $( shell build/mainnet-flags.sh) ./cmd/statusd
2016-10-13 11:46:54 +00:00
@echo "status go compilation done (mainnet)."
@echo "Run \"build/bin/statusgo\" to view available commands"
statusgo-android-mainnet : xgo
2017-11-21 14:40:52 +00:00
$( GOPATH) /bin/xgo --image farazdagi/xgo --go= $( GO) -out statusgo --dest= $( GOBIN) --targets= android-16/aar -v $( shell build/mainnet-flags.sh) ./lib
2016-10-13 11:46:54 +00:00
@echo "Android cross compilation done (mainnet)."
statusgo-ios-mainnet : xgo
2017-11-21 14:40:52 +00:00
$( GOPATH) /bin/xgo --image farazdagi/xgo --go= $( GO) -out statusgo --dest= $( GOBIN) --targets= ios-9.3/framework -v $( shell build/mainnet-flags.sh) ./lib
2016-10-13 11:46:54 +00:00
@echo "iOS framework cross compilation done (mainnet)."
statusgo-ios-simulator-mainnet : xgo
2017-11-21 14:40:52 +00:00
$( GOPATH) /bin/xgo --image farazdagi/xgo-ios-simulator --go= $( GO) -out statusgo --dest= $( GOBIN) --targets= ios-9.3/framework -v $( shell build/mainnet-flags.sh) ./lib
2016-10-13 11:46:54 +00:00
@echo "iOS framework cross compilation done (mainnet)."
2017-10-03 11:54:19 +00:00
generate : ##@other Regenerate assets and other auto-generated stuff
2017-05-01 07:51:59 +00:00
cp ./node_modules/web3/dist/web3.js ./static/scripts/web3.js
2017-11-04 04:20:17 +00:00
go generate ./static
2017-05-01 07:51:59 +00:00
rm ./static/scripts/web3.js
2017-04-06 19:36:55 +00:00
2017-10-11 14:20:51 +00:00
mock-install : ##@other Install mocking tools
2017-09-04 12:56:58 +00:00
go get -u github.com/golang/mock/mockgen
2017-10-11 14:20:51 +00:00
mock : ##@other Regenerate mocks
2017-09-04 12:56:58 +00:00
mockgen -source= geth/common/types.go -destination= geth/common/types_mock.go -package= common
2017-10-09 16:23:09 +00:00
mockgen -source= geth/common/notification.go -destination= geth/common/notification_mock.go -package= common -imports fcm = github.com/NaySoftware/go-fcm
2017-10-11 13:52:11 +00:00
mockgen -source= geth/notification/fcm/client.go -destination= geth/notification/fcm/client_mock.go -package= fcm -imports fcm = github.com/NaySoftware/go-fcm
2017-09-04 12:56:58 +00:00
2017-10-20 10:10:28 +00:00
test : test -unit -coverage ##@tests Run basic, short tests during development
test-unit : ##@tests Run unit and integration tests
2017-11-04 04:20:17 +00:00
go test $( UNIT_TEST_PACKAGES)
2017-10-11 14:20:51 +00:00
2017-10-20 10:10:28 +00:00
test-unit-coverage : ##@tests Run unit and integration tests with coverage
2017-11-04 04:20:17 +00:00
go test -coverpkg= $( UNIT_TEST_PACKAGES)
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.
2017-11-04 04:20:17 +00:00
go test -timeout 5m ./e2e/accounts/... -network= $( networkid)
go test -timeout 5m ./e2e/api/... -network= $( networkid)
go test -timeout 5m ./e2e/node/... -network= $( networkid)
2017-11-08 07:35:29 +00:00
go test -timeout 50m ./e2e/jail/... -network= $( networkid)
2017-11-04 04:20:17 +00:00
go test -timeout 20m ./e2e/rpc/... -network= $( networkid)
go test -timeout 20m ./e2e/whisper/... -network= $( networkid)
go test -timeout 10m ./e2e/transactions/... -network= $( networkid)
2017-11-22 13:06:14 +00:00
# e2e_test tag is required to include some files from ./lib without _test suffix
go test -timeout 40m -tags e2e_test ./lib -network= $( networkid)
2017-10-11 14:20:51 +00:00
2017-11-29 06:48:40 +00:00
ci : lint mock test -unit test -e 2e ##@tests Run all linters and tests at once
2016-12-07 21:07:08 +00:00
2017-10-03 11:54:19 +00:00
clean : ##@other Cleanup
2016-07-20 06:42:19 +00:00
rm -fr build/bin/*
2017-11-07 17:46:11 +00:00
rm -f coverage.out coverage-all.out coverage.html
deep-clean : clean
2017-11-21 14:40:52 +00:00
rm -Rdf .ethereumtest/StatusChain