aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-09-17 00:55:51 +0200
committerLoïc Hoguin <[email protected]>2015-09-17 00:55:51 +0200
commit127426e78657e8faa1194f8fa0fd5084be7fed1d (patch)
tree91ab622598297480e231be474ec94803d18b2c6a /core
parent85e787e36d676c9b11768fa1e9e6263459e49fe2 (diff)
downloaderlang.mk-127426e78657e8faa1194f8fa0fd5084be7fed1d.tar.gz
erlang.mk-127426e78657e8faa1194f8fa0fd5084be7fed1d.tar.bz2
erlang.mk-127426e78657e8faa1194f8fa0fd5084be7fed1d.zip
Add initial 'make rebar.config'
This is a preliminary work, good enough to be used in some, but not all, projects. Tests cover the current functionality. Documentation has been written but will be committed at a later stage, as it covers more than just this target (the target is documented as part of a "Compatibility with other build tools" chapter).
Diffstat (limited to 'core')
-rw-r--r--core/compat.mk25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/compat.mk b/core/compat.mk
new file mode 100644
index 0000000..bdf9a90
--- /dev/null
+++ b/core/compat.mk
@@ -0,0 +1,25 @@
+# Copyright (c) 2015, Loïc Hoguin <[email protected]>
+# This file is part of erlang.mk and subject to the terms of the ISC License.
+
+.PHONY: rebar.config
+
+# We strip out -Werror because we don't want to fail due to
+# warnings when used as a dependency.
+
+define compat_convert_erlc_opt
+$(if $(filter-out -Werror,$1),\
+ $(if $(findstring +,$1),\
+ $(shell echo $1 | cut -b 2-)))
+endef
+
+define compat_rebar_config
+{deps, [$(call comma_list,$(foreach d,$(DEPS),\
+ {$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
+{erl_opts, [$(call comma_list,$(foreach o,$(ERLC_OPTS),$(call compat_convert_erlc_opt,$o)))]}.
+endef
+
+$(eval _compat_rebar_config = $$(compat_rebar_config))
+$(eval export _compat_rebar_config)
+
+rebar.config:
+ $(gen_verbose) echo "$${_compat_rebar_config}" > rebar.config