Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. DOCKER ?= $(shell which docker)
  2. # These docs are in an order that determines how they show up in the PDF/HTML docs.
  3. DOC_FILES := \
  4. README.md \
  5. code-of-conduct.md \
  6. principles.md \
  7. style.md \
  8. ROADMAP.md \
  9. implementations.md \
  10. project.md \
  11. bundle.md \
  12. runtime.md \
  13. runtime-linux.md \
  14. config.md \
  15. config-linux.md \
  16. glossary.md
  17. EPOCH_TEST_COMMIT := 041eb73d2e0391463894c04c8ac938036143eba3
  18. docs: pdf html
  19. .PHONY: docs
  20. pdf:
  21. @mkdir -p output/ && \
  22. $(DOCKER) run \
  23. -it \
  24. --rm \
  25. -v $(shell pwd)/:/input/:ro \
  26. -v $(shell pwd)/output/:/output/ \
  27. -u $(shell id -u) \
  28. vbatts/pandoc -f markdown_github -t latex -o /output/docs.pdf $(patsubst %,/input/%,$(DOC_FILES)) && \
  29. ls -sh $(shell readlink -f output/docs.pdf)
  30. html:
  31. @mkdir -p output/ && \
  32. $(DOCKER) run \
  33. -it \
  34. --rm \
  35. -v $(shell pwd)/:/input/:ro \
  36. -v $(shell pwd)/output/:/output/ \
  37. -u $(shell id -u) \
  38. vbatts/pandoc -f markdown_github -t html5 -o /output/docs.html $(patsubst %,/input/%,$(DOC_FILES)) && \
  39. ls -sh $(shell readlink -f output/docs.html)
  40. HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-)
  41. # this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked.
  42. ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' == '$(1)' && echo 'true')
  43. .PHONY: test .govet .golint .gitvalidation
  44. test: .govet .golint .gitvalidation
  45. # `go get golang.org/x/tools/cmd/vet`
  46. .govet:
  47. go vet -x ./...
  48. # `go get github.com/golang/lint/golint`
  49. .golint:
  50. ifeq ($(call ALLOWED_GO_VERSION,1.5,$(HOST_GOLANG_VERSION)),true)
  51. golint ./...
  52. endif
  53. # `go get github.com/vbatts/git-validation`
  54. .gitvalidation:
  55. git-validation -q -run DCO,short-subject -v -range $(EPOCH_TEST_COMMIT)..HEAD
  56. clean:
  57. rm -rf output/ *~