-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (43 loc) · 1.62 KB
/
Makefile
File metadata and controls
58 lines (43 loc) · 1.62 KB
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
GO_VERSION = 1.6
NAME = gocd-plumber
BUILDDIR = ./ARTIFACTS
# Remove prefix since deb, rpm etc don't recognize this as valid version
VERSION = $(shell git describe --tags --match 'v[0-9]*\.[0-9]*\.[0-9]*' | sed 's/^v//')
###############################################################################
## Building
###############################################################################
.PHONY: all
all: govet gotest build
###############################################################################
## Testing
###############################################################################
.PHONY: govet gotest
govet:
@go vet .
gotest:
@go test . -v
###############################################################################
## Building
##
## Travis CI Gimme is used to cross-compile
## https://github.com/travis-ci/gimme
###############################################################################
compile = bash -c "eval \"$$(GIMME_GO_VERSION=$(GO_VERSION) GIMME_OS=$(1) GIMME_ARCH=$(2) ./gimme)\"; \
go build -a \
-ldflags \"-w -X main.VERSION='$(VERSION)'\" \
-o $(BUILDDIR)/$(NAME)-$(VERSION)-$(1)-$(2)"
.PHONY: build build_darwin build_linux
build: build_darwin build_linux build_windows
build_darwin:
$(call compile,darwin,amd64)
build_linux:
$(call compile,linux,amd64)
build_windows:
$(call compile,windows,amd64)
###############################################################################
## Clean
##
## EXPLICITLY removing artifacts directory to protect from horrible accidents
###############################################################################
clean:
rm -rf ./ARTIFACTS