2016-04-01 21:28:17 +08:00
|
|
|
.PHONY: help check
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
|
|
|
SUBPKGS=cpu disk docker host internal load mem net process
|
|
|
|
|
|
|
|
help: ## Show help
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
check: ## Check
|
|
|
|
errcheck -ignore="Close|Run|Write" ./...
|
2016-08-16 14:42:31 +08:00
|
|
|
golint ./... | egrep -v 'underscores|HttpOnly|should have comment|comment on exported|CamelCase|VM|UID' && exit 1 || exit 0
|
2016-04-01 21:28:17 +08:00
|
|
|
|
2016-08-23 06:31:26 +08:00
|
|
|
BUILD_FAIL_PATTERN=grep -v "exec format error" | grep "build failed" && exit 1 || exit 0
|
2016-04-01 21:28:17 +08:00
|
|
|
build_test: ## test only buildable
|
2016-08-23 06:31:26 +08:00
|
|
|
# Supported operating systems
|
2018-03-31 20:35:53 +08:00
|
|
|
GOOS=linux GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=linux GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=linux GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=linux GOARCH=arm64 go test ./... | $(BUILD_FAIL_PATTERN)
|
2016-08-23 06:31:26 +08:00
|
|
|
GOOS=freebsd go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=windows go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
# Operating systems supported for building only (not implemented error if used)
|
|
|
|
GOOS=solaris go test ./... | $(BUILD_FAIL_PATTERN)
|
2018-03-31 20:35:53 +08:00
|
|
|
GOOS=dragonfly go test ./... | $(BUILD_FAIL_PATTERN)
|
2017-08-03 10:08:35 +08:00
|
|
|
GOOS=netbsd go test ./... | $(BUILD_FAIL_PATTERN)
|
2018-03-31 20:35:53 +08:00
|
|
|
# cross build to OpenBSD not worked since process has "C"
|
|
|
|
# GOOS=openbsd go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
|
|
|
|
ifeq ($(shell uname -s), Darwin)
|
2017-12-31 14:25:49 +08:00
|
|
|
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
|
2018-03-31 20:35:53 +08:00
|
|
|
endif
|
2016-08-23 06:31:26 +08:00
|
|
|
@echo 'Successfully built on all known operating systems'
|
2018-09-16 16:40:02 +08:00
|
|
|
|
|
|
|
init_tools:
|
|
|
|
go get github.com/golang/dep/cmd/dep
|