compat.mk 991 B

12345678910111213141516171819202122232425262728293031
  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_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, [$(call comma_list,$(foreach d,$(DEPS),\
  17. {$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
  18. {erl_opts, $(call compat_erlc_opts_to_list,$(ERLC_OPTS))}.
  19. endef
  20. $(eval _compat_rebar_config = $$(compat_rebar_config))
  21. $(eval export _compat_rebar_config)
  22. rebar.config:
  23. $(gen_verbose) echo "$${_compat_rebar_config}" > rebar.config