Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. GIT ?= git
  2. GO_VARS ?=
  3. GO ?= go
  4. COMMIT := $(shell $(GIT) rev-parse HEAD)
  5. VERSION ?= $(shell $(GIT) describe --tags ${COMMIT} 2> /dev/null || echo "$(COMMIT)")
  6. BUILD_TIME := $(shell LANG=en_US date +"%F_%T_%z")
  7. ROOT := github.com/flashmob/go-guerrilla
  8. LD_FLAGS := -X $(ROOT).Version=$(VERSION) -X $(ROOT).Commit=$(COMMIT) -X $(ROOT).BuildTime=$(BUILD_TIME)
  9. .PHONY: help clean dependencies test
  10. help:
  11. @echo "Please use \`make <ROOT>' where <ROOT> is one of"
  12. @echo " guerrillad to build the main binary for current platform"
  13. @echo " test to run unittests"
  14. clean:
  15. rm -f guerrillad
  16. vendor:
  17. dep ensure
  18. guerrillad:
  19. $(GO_VARS) $(GO) build -o="guerrillad" -ldflags="$(LD_FLAGS)" $(ROOT)/cmd/guerrillad
  20. guerrilladrace:
  21. $(GO_VARS) $(GO) build -o="guerrillad" -race -ldflags="$(LD_FLAGS)" $(ROOT)/cmd/guerrillad
  22. test:
  23. $(GO_VARS) $(GO) test -v .
  24. $(GO_VARS) $(GO) test -v ./tests
  25. $(GO_VARS) $(GO) test -v ./cmd/guerrillad
  26. $(GO_VARS) $(GO) test -v ./response
  27. $(GO_VARS) $(GO) test -v ./backends
  28. $(GO_VARS) $(GO) test -v ./mail
  29. $(GO_VARS) $(GO) test -v ./mail/encoding
  30. $(GO_VARS) $(GO) test -v ./mail/rfc5321
  31. testrace:
  32. $(GO_VARS) $(GO) test -v . -race
  33. $(GO_VARS) $(GO) test -v ./tests -race
  34. $(GO_VARS) $(GO) test -v ./cmd/guerrillad -race
  35. $(GO_VARS) $(GO) test -v ./response -race
  36. $(GO_VARS) $(GO) test -v ./backends -race