hw/Makefile

57 lines
1.9 KiB
Makefile
Raw Normal View History

2018-03-08 14:07:14 -08:00
.PHONY: default
default: bin/hw bin/hwc bin/hwl
2018-03-08 16:09:51 -08:00
VERSION := $(shell git describe --tags 2> /dev/null || echo "unreleased")
V_DIRTY := $(shell git describe --exact-match HEAD 2> /dev/null > /dev/null || echo "-unreleased")
2018-03-08 16:17:54 -08:00
GIT := $(shell git rev-parse --short HEAD)
DIRTY := $(shell git diff-index --quiet HEAD 2> /dev/null > /dev/null || echo "-dirty")
2018-05-11 09:37:16 -07:00
UNTRK := $(shell git ls-files --other --exclude-standard --directory | grep . > /dev/null && echo "-untracked-files")
2018-03-08 16:17:54 -08:00
bin/hw: vendor $(shell ls *.go) cmd/hw/main.go bin
2018-03-08 16:24:00 -08:00
@echo hw
2018-05-10 16:09:36 -07:00
@GOOS=linux go build -ldflags \
2018-03-08 16:17:54 -08:00
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
2018-03-08 16:09:51 -08:00
-v -o bin/hw ./cmd/hw
2018-01-09 16:31:38 -08:00
bin/hwc: vendor $(shell ls *.go ) cmd/hwc/main.go bin
2018-03-08 16:24:00 -08:00
@echo hwc
2018-05-10 16:09:36 -07:00
@GOOS=linux go build -ldflags \
2018-03-08 16:17:54 -08:00
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
2018-03-08 16:09:51 -08:00
-v -o bin/hwc ./cmd/hwc
2018-03-08 14:07:14 -08:00
bin/hwl: vendor $(shell ls *.go) cmd/hwl/main.go bin
2018-03-08 16:24:00 -08:00
@echo hwl
2018-05-10 16:09:36 -07:00
@GOOS=linux go build -ldflags \
2018-03-08 16:17:54 -08:00
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
2018-03-08 16:09:51 -08:00
-v -o bin/hwl ./cmd/hwl
2018-03-08 14:07:14 -08:00
vendor: $(shell find vendor -type f | grep go$$ ) Gopkg.toml Gopkg.lock
dep ensure
2018-01-09 16:31:38 -08:00
bin:
mkdir bin
2018-03-08 16:23:50 -08:00
.PHONY: clean
clean:
@rm -fv bin/{hw,hwl,hwc}
2018-03-08 16:30:54 -08:00
.PHONY: lint
lint:
@golint $(shell go list mcquay.me/hw/...)
@go vet $(shell go list mcquay.me/hw/...)
2018-03-09 10:12:51 -08:00
.PHONY: docker-build
docker-build: bin/hw bin/hwc bin/hwl
2018-05-11 09:37:16 -07:00
docker build -f cmd/hw/Dockerfile . -t smcquay/hw:$(VERSION)$(V_DIRTY)$(DIRTY)$(UNTRK)
docker build -f cmd/hwc/Dockerfile . -t smcquay/hwc:$(VERSION)$(V_DIRTY)$(DIRTY)$(UNTRK)
docker build -f cmd/hwl/Dockerfile . -t smcquay/hwl:$(VERSION)$(V_DIRTY)$(DIRTY)$(UNTRK)
2018-03-09 10:15:19 -08:00
.PHONY: docker-push
docker-push:
docker push smcquay/hw:$(VERSION)$(V_DIRTY)$(DIRTY)
docker push smcquay/hwc:$(VERSION)$(V_DIRTY)$(DIRTY)
docker push smcquay/hwl:$(VERSION)$(V_DIRTY)$(DIRTY)