-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
55 lines (40 loc) · 1.23 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
#!/usr/bin/env bash
SHELL := /bin/bash
PKG := github.com/dh1tw/remoteRotator
COMMITID := $(shell git describe --always --long --dirty)
COMMIT := $(shell git rev-parse --short HEAD)
VERSION := $(shell git describe --tags)
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)
all: build
build:
go generate ./...
go build -v -ldflags="-X github.com/dh1tw/remoteRotator/cmd.commitHash=${COMMIT} \
-X github.com/dh1tw/remoteRotator/cmd.version=${VERSION}"
# strip off dwraf table - used for travis CI
generate:
go generate ./...
cd hub; \
rice embed-go
dist:
go build -v -ldflags="-w -s -X github.com/dh1tw/remoteRotator/cmd.commitHash=${COMMIT} \
-X github.com/dh1tw/remoteRotator/cmd.version=${VERSION}"
# compress binary
if [ "${GOOS}" == "windows" ]; then upx remoteRotator.exe; else upx remoteRotator; fi
# test:
# @go test -short ${PKG_LIST}
vet:
@go vet ${PKG_LIST}
lint:
@for file in ${GO_FILES} ; do \
golint $$file ; \
done
test:
go generate ./...
go test ./...
install-deps:
go get golang.org/x/tools/cmd/stringer
go get github.com/GeertJohan/go.rice/rice
clean:
-@rm remoteRotator remoteRotator-v*
.PHONY: build vet lint clean install-deps generate