-
Notifications
You must be signed in to change notification settings - Fork 4
/
makefile
45 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
PROJECT_NAME := "drmax-gitlab-azdo-migration"
PKG := "github.com/drmaxgit/drmax-gitlab-azdo-migration"
GOARCH := amd64
CI_COMMIT_TAG ?= v0.0.0
.PHONY: all dep clean build
all: clean dep build
check: vet fmt lint
vet: ## Vet code
@go vet
fmt: ## Format code
@go fmt
lint: ## Lint code
@go install golang.org/x/lint/golint
@golint .
test: ## Run tests
@go test
dep: ## Get the dependencies
@go get
build: dep ## Build the binary file
export GOARCH=amd64
GOOS=darwin go build -o bin/$(PROJECT_NAME)-darwin-amd64-$(CI_COMMIT_TAG)
GOOS=windows go build -o bin/$(PROJECT_NAME)-windows-amd64-$(CI_COMMIT_TAG).exe
GOOS=linux go build -o bin/$(PROJECT_NAME)-linux-amd64-$(CI_COMMIT_TAG)
tarball: build
mv bin/$(PROJECT_NAME)-darwin-amd64-$(CI_COMMIT_TAG) $(PROJECT_NAME)-darwin-amd64
mv bin/$(PROJECT_NAME)-windows-amd64-$(CI_COMMIT_TAG).exe $(PROJECT_NAME)-windows-amd64.exe
mv bin/$(PROJECT_NAME)-linux-amd64-$(CI_COMMIT_TAG) $(PROJECT_NAME)-linux-amd64
tar acf $(PROJECT_NAME)-darwin-amd64-$(CI_COMMIT_TAG).tar.gz $(PROJECT_NAME)-darwin-amd64 LICENSE.md
tar acf $(PROJECT_NAME)-windows-amd64-$(CI_COMMIT_TAG).tar.gz $(PROJECT_NAME)-windows-amd64.exe LICENSE.md
tar acf $(PROJECT_NAME)-linux-amd64-$(CI_COMMIT_TAG).tar.gz $(PROJECT_NAME)-linux-amd64 LICENSE.md
clean: ## Remove previous build
@rm -f bin/$(PROJECT_NAME)-*
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}'