ci.mk 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. ci-extra::
  21. ci_verbose_0 = @echo " CI " $(1);
  22. ci_verbose = $(ci_verbose_$(V))
  23. define ci_target
  24. ci-$1: $(KERL_INSTALL_DIR)/$2
  25. $(verbose) $(MAKE) --no-print-directory clean distclean-c_src-env
  26. $(ci_verbose) \
  27. PATH="$(KERL_INSTALL_DIR)/$2/bin:$(PATH)" \
  28. CI_OTP_RELEASE="$1" \
  29. CT_OPTS="-label $1" \
  30. CI_VM="$3" \
  31. $(MAKE) ci-setup tests
  32. $(verbose) $(MAKE) --no-print-directory ci-extra
  33. endef
  34. $(foreach otp,$(CI_OTP),$(eval $(call ci_target,$(otp),$(otp),otp)))
  35. $(foreach otp,$(CI_HIPE),$(eval $(call ci_target,$(otp)-native,$(otp)-native,native)))
  36. $(foreach otp,$(CI_ERLLVM),$(eval $(call ci_target,$(otp)-erllvm,$(otp)-native,erllvm)))
  37. $(foreach otp,$(CI_OTP),$(eval $(call kerl_otp_target,$(otp))))
  38. $(foreach otp,$(sort $(CI_HIPE) $(CI_ERLLLVM)),$(eval $(call kerl_hipe_target,$(otp))))
  39. help::
  40. $(verbose) printf "%s\n" "" \
  41. "Continuous Integration targets:" \
  42. " ci Run '$(MAKE) tests' on all configured Erlang versions." \
  43. "" \
  44. "The CI_OTP variable must be defined with the Erlang versions" \
  45. "that must be tested. For example: CI_OTP = OTP-17.3.4 OTP-17.5.3"
  46. endif