This repository has been archived by the owner on Feb 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
61 lines (47 loc) · 1.5 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
PACKAGE = cibully
IMPORT_PATH := github.com/ahelal/ci-bully
DATE ?= $(shell date +%FT%T%z)
VERSION ?= $(shell cat $(CURDIR)/.VERSION 2> /dev/null || echo v0)
GOLINT_COMMAND := $(shell command -v golint 2> /dev/null)
M = $(shell printf "\033[34;1m▶\033[0m")
include *.mk
.PHONY: all deps test lint
all: deps test lint dev
dev: set_dev build_linux build_darwin
release: set_release build_linux build_darwin
deps:
ifneq (,$(wildcard ./glide.yml))
$(info $(M) Installing glide dependencies…)
@go get -u github.com/Masterminds/glide
@glide install
endif
$(info $(M) GO get dependencies…)
@#@go get
test:
$(info $(M) GO get dependencies…)
set_release:
$(eval VERSION_NAME := $(VERSION))
$(eval BUILD_NAME := Release)
set_dev:
$(eval VERSION_NAME := $(VERSION)-$(DATE))
$(eval BUILD_NAME := DEV)
$(eval PACKAGE := ${PACKAGE}_dev)
build_linux:
$(info $(M) Building $(BUILD_NAME) linux version $(VERSION_NAME)…)
@GOOS=linux GOARCH=amd64 go build \
-tags release \
-ldflags '-X main.version=$(VERSION_NAME)' \
-o build/$(PACKAGE)_$(VERSION)_linux_amd64 *.go
build_darwin:
$(info $(M) Building $(BUILD_NAME) darwin version $(VERSION_NAME)…)
@GOOS=darwin GOARCH=amd64 go build \
-tags release \
-ldflags '-X main.version=$(VERSION_NAME)' \
-o build/$(PACKAGE)_$(VERSION)_darwin_amd64 *.go
lint:
ifndef GOLINT_COMMAND
$(info $(M) Installing golint…)
@go get -u github.com/golang/lint/golint
endif
$(info $(M) Linting…)
@golint -set_exit_status $(go list ./... | grep -v /vendor/)