compat.mk 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (c) 2015-2016, 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: rebar.config
  4. # We strip out -Werror because we don't want to fail due to
  5. # warnings when used as a dependency.
  6. compat_prepare_erlc_opts = $(shell echo "$1" | sed 's/, */,/g')
  7. define compat_convert_erlc_opts
  8. $(if $(filter-out -Werror,$1),\
  9. $(if $(findstring +,$1),\
  10. $(shell echo $1 | cut -b 2-)))
  11. endef
  12. define compat_erlc_opts_to_list
  13. [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$1),$(call compat_convert_erlc_opts,$o)))]
  14. endef
  15. define compat_rebar_config
  16. {deps, [
  17. $(call comma_list,$(foreach d,$(DEPS),\
  18. $(if $(filter hex,$(call dep_fetch,$d)),\
  19. {$(call dep_name,$d)$(comma)"$(call dep_repo,$d)"},\
  20. {$(call dep_name,$d)$(comma)".*"$(comma){git,"$(call dep_repo,$d)"$(comma)"$(call dep_commit,$d)"}})))
  21. ]}.
  22. {erl_opts, $(call compat_erlc_opts_to_list,$(ERLC_OPTS))}.
  23. endef
  24. rebar.config:
  25. $(gen_verbose) $(call core_render,compat_rebar_config,rebar.config)