This repository has been archived by the owner on Sep 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
79 lines (51 loc) · 1.76 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ifeq (${TRAVIS_TAG},)
VERSION:=0.0.0
else
VERSION:=${TRAVIS_TAG}
endif
export GO15VENDOREXPERIMENT=1
default: build
PACKAGES:=`go list ./... | grep -v old | grep -v /vendor/|grep -v plugins`
filename:=$(basename $(notdir ${CURDIR}))
bin_name:=sdt
MAIN_PACKAGE:=`go list -f "{{.Name}}|{{.ImportPath}}" ../...|grep -v "/vendor/" | grep -v "build" |grep "main|" | sed s:"main|":"":g`
.PHONY: test
test:
go test -covermode=count -v ${PACKAGES}
.PHONY: coverage
coverage:
go test -coverprofile=coverage.out -v ${PACKAGES}
.PHONY: record
record:
RECORDING=1 go test -v `glide novendor |grep -Ev "^\.$$"|grep -v "plugins"`
.PHONY: install-deps
install-deps:
glide install --strip-vcs --strip-vendor
.PHONY: deps
deps:
glide up --strip-vcs --strip-vendor
find . -type f -name ".gitmodules" -exec rm -f {} \;
.PHONY: vendor
vendor: deps
.PHONY: fmt
fmt:
go fmt `glide nv`
BUILD_VERSION:=${VERSION}-$(shell git log -n 1 --pretty=format:'%H')
VER_FLAG:=--ldflags '-X github.com/capitalone/stack-deployment-tool/sdt.Version=$(BUILD_VERSION)'
.PHONY: quick
quick: build_darwin
.PHONY: build_linux
build_linux:
export GOOS=$(subst build_,,$@) && export GOARCH="amd64" && mkdir -p build/$${GOOS}_$${GOARCH} && cd build &&\
go build ${VER_FLAG} -o ${bin_name}_$${GOOS}_$${GOARCH} ${MAIN_PACKAGE} && cp ${bin_name}_$${GOOS}_$${GOARCH} $${GOOS}_$${GOARCH}/${bin_name}
.PHONY: build_darwin
build_darwin:
export GOOS=$(subst build_,,$@) && export GOARCH="amd64" && mkdir -p build/$${GOOS}_$${GOARCH} && cd build &&\
go build ${VER_FLAG} -o ${bin_name}_$${GOOS}_$${GOARCH} ${MAIN_PACKAGE} && cp ${bin_name}_$${GOOS}_$${GOARCH} $${GOOS}_$${GOARCH}/${bin_name}
.PHONY: build
build: clean test build_darwin build_linux
.PHONY: release
release: build
.PHONY: clean
clean:
rm -rf build