Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. REBAR_VERSION = 3.14.3-emqx-2
  2. REBAR = ./rebar3
  3. export PKG_VSN ?= $(shell git describe --tags --always)
  4. # comma separated versions
  5. export RELUP_BASE_VERSIONS ?=
  6. PROFILE ?= emqx
  7. PROFILES := emqx emqx-edge check test
  8. PKG_PROFILES := emqx-pkg emqx-edge-pkg
  9. export REBAR_GIT_CLONE_OPTIONS += --depth=1
  10. .PHONY: default
  11. default: $(REBAR) $(PROFILE)
  12. .PHONY: all
  13. all: $(REBAR) $(PROFILES)
  14. .PHONY: ensure-rebar3
  15. ensure-rebar3:
  16. @./ensure-rebar3.sh $(REBAR_VERSION)
  17. $(REBAR): ensure-rebar3
  18. .PHONY: eunit
  19. eunit: $(REBAR)
  20. $(REBAR) eunit
  21. .PHONY: ct
  22. ct: $(REBAR)
  23. $(REBAR) ct
  24. .PHONY: $(PROFILES)
  25. $(PROFILES:%=%): $(REBAR)
  26. ifneq ($(shell echo $(@) |grep edge),)
  27. export EMQX_DESC="EMQ X Edge"
  28. else
  29. export EMQX_DESC="EMQ X Broker"
  30. endif
  31. $(REBAR) as $(@) release
  32. .PHONY: $(PROFILES:%=build-%)
  33. $(PROFILES:%=build-%): $(REBAR)
  34. $(REBAR) as $(@:build-%=%) compile
  35. # rebar clean
  36. .PHONY: clean $(PROFILES:%=clean-%)
  37. clean: $(PROFILES:%=clean-%)
  38. $(PROFILES:%=clean-%): $(REBAR)
  39. $(REBAR) as $(@:clean-%=%) clean
  40. .PHONY: deps-all
  41. deps-all: $(REBAR) $(PROFILES:%=deps-%) $(PKG_PROFILES:%=deps-%)
  42. .PHONY: $(PROFILES:%=deps-%) $(PKG_PROFILES:%=deps-%)
  43. $(PROFILES:%=deps-%) $(PKG_PROFILES:%=deps-%): $(REBAR)
  44. ifneq ($(shell echo $(@) |grep edge),)
  45. export EMQX_DESC="EMQ X Edge"
  46. else
  47. export EMQX_DESC="EMQ X Broker"
  48. endif
  49. $(REBAR) as $(@:deps-%=%) get-deps
  50. .PHONY: xref
  51. xref: $(REBAR)
  52. $(REBAR) as check xref
  53. .PHONY: dialyzer
  54. dialyzer: $(REBAR)
  55. $(REBAR) as check dialyzer
  56. include packages.mk
  57. include docker.mk