2016-02-21 09:38:54 +00:00
|
|
|
.PHONY: all clean deps fmt vet test docker
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
EXECUTABLE ?= drone-terraform
|
|
|
|
IMAGE ?= plugins/$(EXECUTABLE)
|
2015-11-10 14:52:53 +00:00
|
|
|
|
2016-01-26 22:47:58 +00:00
|
|
|
LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')"
|
2016-01-27 06:22:07 +00:00
|
|
|
PACKAGES = $(shell go list ./... | grep -v /vendor/)
|
2015-11-10 14:52:53 +00:00
|
|
|
|
2016-02-21 09:38:54 +00:00
|
|
|
all: deps build test
|
|
|
|
|
2015-11-10 14:52:53 +00:00
|
|
|
clean:
|
2016-01-27 06:22:07 +00:00
|
|
|
go clean -i ./...
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
deps:
|
2016-01-27 06:22:07 +00:00
|
|
|
go get -t ./...
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
fmt:
|
2016-01-27 06:22:07 +00:00
|
|
|
go fmt $(PACKAGES)
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
vet:
|
2016-01-27 06:22:07 +00:00
|
|
|
go vet $(PACKAGES)
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
test:
|
2016-01-27 06:22:07 +00:00
|
|
|
@for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
docker:
|
2016-01-27 06:22:07 +00:00
|
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w $(LDFLAGS)'
|
|
|
|
docker build --rm -t $(IMAGE) .
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
$(EXECUTABLE): $(wildcard *.go)
|
2016-01-27 06:22:07 +00:00
|
|
|
go build -ldflags '-s -w $(LDFLAGS)'
|
2016-01-26 22:47:58 +00:00
|
|
|
|
|
|
|
build: $(EXECUTABLE)
|