Makefile 2.6 KB

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