aboutsummaryrefslogtreecommitdiffstats
path: root/core/compat.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-09-25 15:02:18 +0200
committerLoïc Hoguin <[email protected]>2015-09-25 15:02:18 +0200
commitc1131f4f7420d009c8a05e5de9dd0888127aa0aa (patch)
tree82bca447620e483b0de1de6b8ab6ed7104b526ee /core/compat.mk
parentace7252ee3e34e803345236950e93dae590bb7c1 (diff)
downloaderlang.mk-c1131f4f7420d009c8a05e5de9dd0888127aa0aa.tar.gz
erlang.mk-c1131f4f7420d009c8a05e5de9dd0888127aa0aa.tar.bz2
erlang.mk-c1131f4f7420d009c8a05e5de9dd0888127aa0aa.zip
Fix error messages appearing when using parse transforms
The errors were happening in the rebar.config generation code. In addition to the fix, three tests were added: a project that uses a pt from its own code with -compile directives, a project that uses a pt from a dep with the pt set as ERLC_OPTS, and the inclusion of parse transform options in the generated rebar.config when compatibility is desired.
Diffstat (limited to 'core/compat.mk')
-rw-r--r--core/compat.mk7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/compat.mk b/core/compat.mk
index bdf9a90..f936768 100644
--- a/core/compat.mk
+++ b/core/compat.mk
@@ -6,7 +6,9 @@
# We strip out -Werror because we don't want to fail due to
# warnings when used as a dependency.
-define compat_convert_erlc_opt
+compat_prepare_erlc_opts = $(shell echo "$1" | sed 's/, */,/')
+
+define compat_convert_erlc_opts
$(if $(filter-out -Werror,$1),\
$(if $(findstring +,$1),\
$(shell echo $1 | cut -b 2-)))
@@ -15,7 +17,8 @@ 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)))]}.
+{erl_opts, [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$(ERLC_OPTS)),\
+ $(call compat_convert_erlc_opts,$o)))]}.
endef
$(eval _compat_rebar_config = $$(compat_rebar_config))