Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. REBAR_VERSION = 3.14.3-emqx-4
  2. DASHBOARD_VERSION = v4.3.0
  3. REBAR = $(CURDIR)/rebar3
  4. BUILD = $(CURDIR)/build
  5. export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh)
  6. PROFILE ?= emqx
  7. REL_PROFILES := emqx emqx-edge
  8. PKG_PROFILES := emqx-pkg emqx-edge-pkg
  9. PROFILES := $(REL_PROFILES) $(PKG_PROFILES)
  10. export REBAR_GIT_CLONE_OPTIONS += --depth=1
  11. .PHONY: default
  12. default: $(REBAR) $(PROFILE)
  13. .PHONY: all
  14. all: $(REBAR) $(PROFILES)
  15. .PHONY: ensure-rebar3
  16. ensure-rebar3:
  17. $(CURDIR)/ensure-rebar3.sh $(REBAR_VERSION)
  18. $(REBAR): ensure-rebar3
  19. .PHONY: get-dashboard
  20. get-dashboard:
  21. $(CURDIR)/get-dashboard.sh $(DASHBOARD_VERSION)
  22. .PHONY: eunit
  23. eunit: $(REBAR)
  24. $(REBAR) eunit
  25. .PHONY: proper
  26. proper: $(REBAR)
  27. $(REBAR) as test proper -d test/props -c
  28. .PHONY: ct
  29. ct: $(REBAR)
  30. $(REBAR) ct --name 'test@127.0.0.1' -c -v
  31. .PHONY: cover
  32. cover: $(REBAR)
  33. $(REBAR) cover
  34. .PHONY: coveralls
  35. coveralls: $(REBAR)
  36. $(REBAR) as test coveralls send
  37. .PHONY: $(REL_PROFILES)
  38. $(REL_PROFILES:%=%): $(REBAR) get-dashboard
  39. ifneq ($(shell echo $(@) |grep edge),)
  40. export EMQX_DESC="EMQ X Edge"
  41. else
  42. export EMQX_DESC="EMQ X Broker"
  43. endif
  44. $(REBAR) as $(@) release
  45. # rebar clean
  46. .PHONY: clean $(PROFILES:%=clean-%)
  47. clean: $(PROFILES:%=clean-%)
  48. $(PROFILES:%=clean-%): $(REBAR)
  49. $(REBAR) as $(@:clean-%=%) clean
  50. rm -rf apps/emqx_dashboard/priv/www
  51. .PHONY: deps-all
  52. deps-all: $(REBAR) $(PROFILES:%=deps-%)
  53. .PHONY: $(PROFILES:%=deps-%)
  54. $(PROFILES:%=deps-%): $(REBAR) get-dashboard
  55. ifneq ($(shell echo $(@) |grep edge),)
  56. export EMQX_DESC="EMQ X Edge"
  57. else
  58. export EMQX_DESC="EMQ X Broker"
  59. endif
  60. $(REBAR) as $(@:deps-%=%) get-deps
  61. .PHONY: xref
  62. xref: $(REBAR)
  63. $(REBAR) as check xref
  64. .PHONY: dialyzer
  65. dialyzer: $(REBAR)
  66. $(REBAR) as check dialyzer
  67. .PHONY: $(REL_PROFILES:%=relup-%)
  68. $(REL_PROFILES:%=relup-%): $(REBAR)
  69. ifneq ($(OS),Windows_NT)
  70. $(BUILD) $(@:relup-%=%) relup
  71. endif
  72. .PHONY: $(REL_PROFILES:%=%-tar) $(PKG_PROFILES:%=%-tar)
  73. $(REL_PROFILES:%=%-tar) $(PKG_PROFILES:%=%-tar): $(REBAR) get-dashboard
  74. $(BUILD) $(subst -tar,,$(@)) tar
  75. ## zip targets depend on the corresponding relup and tar artifacts
  76. .PHONY: $(REL_PROFILES:%=%-zip)
  77. define gen-zip-target
  78. $1-zip: relup-$1 $1-tar
  79. $(BUILD) $1 zip
  80. endef
  81. ALL_ZIPS = $(REL_PROFILES) $(PKG_PROFILES)
  82. $(foreach zt,$(ALL_ZIPS),$(eval $(call gen-zip-target,$(zt))))
  83. ## A pkg target depend on a regular release profile zip to include relup,
  84. ## and also a -pkg suffixed profile tar (without relup) for making deb/rpm package
  85. .PHONY: $(PKG_PROFILES)
  86. define gen-pkg-target
  87. $1: $(subst -pkg,,$1)-zip $1-tar
  88. $(BUILD) $1 pkg
  89. endef
  90. $(foreach pt,$(PKG_PROFILES),$(eval $(call gen-pkg-target,$(pt))))
  91. include docker.mk