This repository has been archived by the owner on Jul 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
74 lines (52 loc) · 1.88 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
ifndef GOPATH
$(error GOPATH is not set)
endif
PACKAGE_NAME = github.com/puppetlabs/lumogon
CONTAINER_NAME = puppet/lumogon
LDFLAGS += -X "$(PACKAGE_NAME)/version.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
LDFLAGS += -X "$(PACKAGE_NAME)/version.BuildVersion=$(shell date +%Y%m%d%H%M%S)-$(shell git describe --tags)"
LDFLAGS += -X "$(PACKAGE_NAME)/version.BuildSHA=$(shell git rev-parse HEAD)"
# Strip debug information
LDFLAGS += -s
TESTLDFLAGS += -X "$(PACKAGE_NAME)/version.BuildTime=testdatestring"
TESTLDFLAGS += -X "$(PACKAGE_NAME)/version.BuildVersion=testversionstring"
TESTLDFLAGS += -X "$(PACKAGE_NAME)/version.BuildSHA=testbuildsha"
# Strip debug information - see https://github.com/golang/go/issues/19734
TESTLDFLAGS += -s
GOARCH ?= amd64
GOOS ?= linux
build: bin/lumogon
test: lint vet
go test -v -cover ./... -ldflags '$(TESTLDFLAGS)'
watch: bootstrap
goconvey
bin/lumogon: bootstrap
mkdir -p bin
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -a -ldflags '$(LDFLAGS)' -o bin/lumogon lumogon.go
clean:
rm -rf bin/*;
go clean -i ./...
image:
docker build -t $(CONTAINER_NAME) .
deploy: image
script/deploy
todo:
grep -rnw "TODO" .
lint: bootstrap
@echo "Linting..."
@for d in $$(go list ./... | grep -v /vendor/); do golint $${d}; done
vet: bootstrap
@for d in $$(go list ./... | grep -v /vendor/); do go vet $${d}; done
licenses: $(GOPATH)/bin/licenses
@licenses $(PACKAGE_NAME) | grep $(PACKAGE_NAME)/vendor
all: clean test build image puppet-module
$(GOPATH)/bin/golint:
go get -u golang.org/x/lint/golint
$(GOPATH)/bin/licenses:
go get -u github.com/pmezard/licenses
$(GOPATH)/bin/goconvey:
go get -u github.com/smartystreets/goconvey
bootstrap: $(GOPATH)/bin/golint $(GOPATH)/bin/licenses $(GOPATH)/bin/goconvey
puppet-module:
cd contrib/puppetlabs-lumogon; make all
.PHONY: build image test todo clean bootstrap licenses watch deploy puppet-module