compat.mk 919 B

12345678910111213141516171819202122232425262728
  1. # Copyright (c) 2015, 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/, */,/')
  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_rebar_config
  13. {deps, [$(call comma_list,$(foreach d,$(DEPS),\
  14. {$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
  15. {erl_opts, [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$(ERLC_OPTS)),\
  16. $(call compat_convert_erlc_opts,$o)))]}.
  17. endef
  18. $(eval _compat_rebar_config = $$(compat_rebar_config))
  19. $(eval export _compat_rebar_config)
  20. rebar.config:
  21. $(gen_verbose) echo "$${_compat_rebar_config}" > rebar.config