ci.mk 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright (c) 2015-2017, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. .PHONY: ci ci-prepare ci-setup
  4. CI_OTP ?=
  5. CI_HIPE ?=
  6. CI_ERLLVM ?=
  7. ifeq ($(CI_VM),native)
  8. ERLC_OPTS += +native
  9. TEST_ERLC_OPTS += +native
  10. else ifeq ($(CI_VM),erllvm)
  11. ERLC_OPTS += +native +'{hipe, [to_llvm]}'
  12. TEST_ERLC_OPTS += +native +'{hipe, [to_llvm]}'
  13. endif
  14. ifeq ($(strip $(CI_OTP) $(CI_HIPE) $(CI_ERLLVM)),)
  15. ci::
  16. else
  17. ci:: $(addprefix ci-,$(CI_OTP) $(addsuffix -native,$(CI_HIPE)) $(addsuffix -erllvm,$(CI_ERLLVM)))
  18. ci-prepare: $(addprefix $(KERL_INSTALL_DIR)/,$(CI_OTP) $(addsuffix -native,$(CI_HIPE)))
  19. ci-setup::
  20. $(verbose) :
  21. ci-extra::
  22. $(verbose) :
  23. ci_verbose_0 = @echo " CI " $(1);
  24. ci_verbose = $(ci_verbose_$(V))
  25. define ci_target
  26. ci-$1: $(KERL_INSTALL_DIR)/$2
  27. $(verbose) $(MAKE) --no-print-directory clean
  28. $(ci_verbose) \
  29. PATH="$(KERL_INSTALL_DIR)/$2/bin:$(PATH)" \
  30. CI_OTP_RELEASE="$1" \
  31. CT_OPTS="-label $1" \
  32. CI_VM="$3" \
  33. $(MAKE) ci-setup tests
  34. $(verbose) $(MAKE) --no-print-directory ci-extra
  35. endef
  36. $(foreach otp,$(CI_OTP),$(eval $(call ci_target,$(otp),$(otp),otp)))
  37. $(foreach otp,$(CI_HIPE),$(eval $(call ci_target,$(otp)-native,$(otp)-native,native)))
  38. $(foreach otp,$(CI_ERLLVM),$(eval $(call ci_target,$(otp)-erllvm,$(otp)-native,erllvm)))
  39. $(foreach otp,$(filter-out $(ERLANG_OTP),$(CI_OTP)),$(eval $(call kerl_otp_target,$(otp))))
  40. $(foreach otp,$(filter-out $(ERLANG_HIPE),$(sort $(CI_HIPE) $(CI_ERLLLVM))),$(eval $(call kerl_hipe_target,$(otp))))
  41. help::
  42. $(verbose) printf "%s\n" "" \
  43. "Continuous Integration targets:" \
  44. " ci Run '$(MAKE) tests' on all configured Erlang versions." \
  45. "" \
  46. "The CI_OTP variable must be defined with the Erlang versions" \
  47. "that must be tested. For example: CI_OTP = OTP-17.3.4 OTP-17.5.3"
  48. endif