-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
48 lines (36 loc) · 1.24 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
.PHONY: build build-alpine clean test help default
BIN_NAME=ipfix-forwarder
VERSION := $(shell grep "const Version " version.go | sed -E 's/.*"(.+)"$$/\1/')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_DIRTY=$(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true)
IMAGE_NAME := "none/ipfix-forwarder"
default: test
help:
@echo 'Management commands for ipfix-forwarder:'
@echo
@echo 'Usage:'
@echo ' make build Compile the project.'
@echo ' make clean Clean the directory tree.'
@echo
build:
@echo "building ${BIN_NAME} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X main.VersionPrerelease=DEV" -o bin/${BIN_NAME}
release:
@echo "releasing ${BIN_NAME} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -s -w" -o bin/${BIN_NAME}
cd bin && tar -cvzf ${BIN_NAME}.tgz ${BIN_NAME}
clean:
@test ! -e bin/${BIN_NAME} || rm bin/${BIN_NAME}
test:
go test -v
coverage:
go test -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out
coverage-html:
go test -covermode=count -coverprofile=coverage.out
go tool cover -html=coverage.out
lint:
go get -u golang.org/x/lint/golint
golint .