Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. REBAR_VERSION = 3.14.3-emqx-1
  2. REBAR = ./rebar3
  3. PROFILE ?= emqx
  4. PROFILES := emqx emqx-edge
  5. PKG_PROFILES := emqx-pkg emqx-edge-pkg
  6. export REBAR_GIT_CLONE_OPTIONS += --depth=1
  7. .PHONY: default
  8. default: $(REBAR) $(PROFILE)
  9. .PHONY: all
  10. all: $(REBAR) $(PROFILES)
  11. .PHONY: ensure-rebar3
  12. ensure-rebar3:
  13. @./ensure-rebar3.sh $(REBAR_VERSION)
  14. $(REBAR): ensure-rebar3
  15. .PHONY: distclean
  16. distclean:
  17. @rm -rf _build
  18. .PHONY: $(PROFILES)
  19. $(PROFILES:%=%): $(REBAR)
  20. ifneq ($(shell echo $(@) |grep edge),)
  21. export EMQX_DESC="EMQ X Edge"
  22. else
  23. export EMQX_DESC="EMQ X Broker"
  24. endif
  25. $(REBAR) as $(@) release
  26. .PHONY: $(PROFILES:%=build-%)
  27. $(PROFILES:%=build-%): $(REBAR)
  28. $(REBAR) as $(@:build-%=%) compile
  29. # rebar clean
  30. .PHONY: clean $(PROFILES:%=clean-%)
  31. clean: $(PROFILES:%=clean-%) clean-stamps
  32. $(PROFILES:%=clean-%): $(REBAR)
  33. $(REBAR) as $(@:clean-%=%) clean
  34. .PHONY: clean-stamps
  35. clean-stamps:
  36. find -L _build -name '.stamp' -type f | xargs rm -f
  37. .PHONY: deps-all
  38. deps-all: $(REBAR) $(PROFILES:%=deps-%) $(PKG_PROFILES:%=deps-%)
  39. .PHONY: $(PROFILES:%=deps-%) $(PKG_PROFILES:%=deps-%)
  40. $(PROFILES:%=deps-%) $(PKG_PROFILES:%=deps-%): $(REBAR)
  41. ifneq ($(shell echo $(@) |grep edge),)
  42. export EMQX_DESC="EMQ X Edge"
  43. else
  44. export EMQX_DESC="EMQ X Broker"
  45. endif
  46. $(REBAR) as $(@:deps-%=%) get-deps
  47. .PHONY: xref
  48. xref: $(REBAR)
  49. $(REBAR) as test xref
  50. .PHONY: dialyzer
  51. dialyzer: $(REBAR)
  52. $(REBAR) as test dialyzer
  53. include packages.mk
  54. include docker.mk