forked from IntellexApps/blcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (34 loc) · 1.48 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
GO_BIN := $(shell which go)
GO_LINT := $(shell which golint)
UPX := $(shell which upx)
PROJECT_NAME := "blcheck"
PKG := "github.com/teqneers/$(PROJECT_NAME)"
PKG_LIST := $(shell go list ${PKG}/...)
GO_FILES := $(shell find . -name '*.go' | grep -v _test.go)
.PHONY: all dep build clean test race lint buildmacos buildlinux compressmacos compresslinux release
all: release
lint: ## Lint the files
${GO_LINT} -set_exit_status ${PKG_LIST}
test: ## Run unittests
${GO_BIN} test -short ${PKG_LIST}
race: ## Run race tests
${GO_BIN} test -race -short ${PKG_LIST}
dep: ## Get the dependencies
${GO_BIN} get -v -d ./...
${GO_BIN} get -u golang.org/x/lint/golint
buildmacos: dep ## Build the binary file
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 ${GO_BIN} build -a -ldflags '-extldflags "-static"' -o blchecker.macos $(PKG)
buildlinux: dep ## Build the binary file
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ${GO_BIN} build -a -ldflags '-extldflags "-static"' -o blchecker.linux $(PKG)
compressmacos: ## Build the binary file
${UPX} ./blchecker.macos
${UPX} -t ./blchecker.macos
compresslinux: ## Build the binary file
${UPX} ./blchecker.linux
${UPX} -t ./blchecker.linux
clean: ## Remove previous build
@rm -f ./blchecker.macos
@rm -f ./blchecker.linux
release: clean dep test race buildmacos compressmacos buildlinux compresslinux
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'