No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .PHONY: default
  2. default: bin/hw bin/hwc bin/hwl
  3. VERSION := $(shell git describe --tags 2> /dev/null || echo "unreleased")
  4. V_DIRTY := $(shell git describe --exact-match HEAD 2> /dev/null > /dev/null || echo "-unreleased")
  5. GIT := $(shell git rev-parse --short HEAD)
  6. DIRTY := $(shell git diff-index --quiet HEAD 2> /dev/null > /dev/null || echo "-dirty")
  7. UNTRK := $(shell git ls-files --other --exclude-standard --directory | grep . > /dev/null && echo "-untracked-files")
  8. bin/hw: vendor $(shell ls *.go) cmd/hw/main.go bin
  9. @echo hw
  10. @GOOS=linux go build -ldflags \
  11. "-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
  12. -X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
  13. -v -o bin/hw ./cmd/hw
  14. bin/hwc: vendor $(shell ls *.go ) cmd/hwc/main.go bin
  15. @echo hwc
  16. @GOOS=linux go build -ldflags \
  17. "-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
  18. -X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
  19. -v -o bin/hwc ./cmd/hwc
  20. bin/hwl: vendor $(shell ls *.go) cmd/hwl/main.go bin
  21. @echo hwl
  22. @GOOS=linux go build -ldflags \
  23. "-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
  24. -X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
  25. -v -o bin/hwl ./cmd/hwl
  26. vendor: $(shell find vendor -type f | grep go$$ ) Gopkg.toml Gopkg.lock
  27. dep ensure
  28. bin:
  29. mkdir bin
  30. .PHONY: clean
  31. clean:
  32. @rm -fv bin/{hw,hwl,hwc}
  33. .PHONY: lint
  34. lint:
  35. @golint $(shell go list mcquay.me/hw/...)
  36. @go vet $(shell go list mcquay.me/hw/...)
  37. .PHONY: docker-build
  38. docker-build: bin/hw bin/hwc bin/hwl
  39. docker build -f cmd/hw/Dockerfile . -t smcquay/hw:$(VERSION)$(V_DIRTY)$(DIRTY)$(UNTRK)
  40. docker build -f cmd/hwc/Dockerfile . -t smcquay/hwc:$(VERSION)$(V_DIRTY)$(DIRTY)$(UNTRK)
  41. docker build -f cmd/hwl/Dockerfile . -t smcquay/hwl:$(VERSION)$(V_DIRTY)$(DIRTY)$(UNTRK)
  42. .PHONY: docker-push
  43. docker-push:
  44. docker push smcquay/hw:$(VERSION)$(V_DIRTY)$(DIRTY)
  45. docker push smcquay/hwc:$(VERSION)$(V_DIRTY)$(DIRTY)
  46. docker push smcquay/hwl:$(VERSION)$(V_DIRTY)$(DIRTY)