-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMakefile
50 lines (39 loc) · 1.2 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
#
# Makefile
#
# The kickoff point for all project management commands.
#
# Program version
VERSION := $(shell grep "const Version " version.go | sed -E 's/.*"(.+)"$$/\1/')
GOPATH := $(shell go env GOPATH)
default: build
help:
@echo 'Management commands for mock-ec2-metadata:'
@echo
@echo 'Usage:'
@echo ' make build Compile the project.'
@echo ' make deps Download dependencies.'
@echo ' make test Run tests on a compiled project.'
@echo ' make fmt Reformat the source tree with gofmt.'
@echo ' make clean Clean the directory tree.'
@echo
deps:
@go get github.com/mitchellh/gox
@go get github.com/tcnksm/ghr
@go get -v .;
@go mod tidy;
# Runs the go vet command, will be a dependency for any test.
vet:
@go vet .
@go vet ./...
build:
$(GOPATH)/bin/gox -verbose -output "bin/mock-ec2-metadata_${VERSION}_{{.OS}}_{{.Arch}}" -os="linux" -os="darwin" -arch="386" -arch="amd64" ./cmd/server
release:
$(GOPATH)/bin/ghr --username NYTimes --token ${GITHUB_TOKEN} -r mock-ec2-metadata --replace ${VERSION} bin/
clean:
@test ! -e bin/|| rm -f bin/*
tests:
go test ./...
fmt:
find . -name '*.go' -exec gofmt -w=true {} ';'
.PHONY: build dist clean test help default fmt