aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md13
-rw-r--r--build.config1
-rw-r--r--erlang.mk39
-rw-r--r--plugins/xref.mk38
4 files changed, 91 insertions, 0 deletions
diff --git a/README.md b/README.md
index b3ade31..2c0c4bc 100644
--- a/README.md
+++ b/README.md
@@ -538,6 +538,19 @@ Or:
$ make triq t=cow_http_hd:prop_parse_accept
```
+Xref plugin
+------------
+
+This plugin is available by default. It adds the following
+target:
+
+`xref` Erlang Xref Runner (inspired in rebar's rebar_xref)
+
+The `XREF_CONFIG` variable specifies the location of the
+configuration file which holds the checks to be applied.
+If there is no `xref.config` all `xref` checks will be
+applied to the binaries located in the `/ebin` directory.
+
Contributing
------------
diff --git a/build.config b/build.config
index 7e60d80..7ceca41 100644
--- a/build.config
+++ b/build.config
@@ -22,3 +22,4 @@ plugins/eunit
plugins/relx
plugins/shell
plugins/triq
+plugins/xref
diff --git a/erlang.mk b/erlang.mk
index d334dc9..76ee830 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -1275,3 +1275,42 @@ triq: test-build
$(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
endif
endif
+
+# Copyright (c) 2015, Euen Lopez <[email protected]>
+# This file is part of erlang.mk and subject to the terms of the ISC License.
+
+.PHONY: xref distclean-xref
+
+# Configuration.
+
+ifeq ($(XREF_CONFIG),)
+ XREF_ARGS :=
+else
+ XREF_ARGS := -c $(XREF_CONFIG)
+endif
+
+XREFR ?= $(CURDIR)/xrefr
+export XREFR
+
+XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/0.2.0/xrefr
+
+# Core targets.
+
+help::
+ @printf "%s\n" "" \
+ "Xref targets:" \
+ " xref Run Xrefr using $XREF_CONFIG as config file if defined"
+
+distclean:: distclean-xref
+
+# Plugin-specific targets.
+
+$(XREFR):
+ @$(call core_http_get,$(XREFR),$(XREFR_URL))
+ @chmod +x $(XREFR)
+
+xref: deps app $(XREFR)
+ $(gen_verbose) $(XREFR) $(XREFR_ARGS)
+
+distclean-xref:
+ $(gen_verbose) rm -rf $(XREFR)
diff --git a/plugins/xref.mk b/plugins/xref.mk
new file mode 100644
index 0000000..cd1cc64
--- /dev/null
+++ b/plugins/xref.mk
@@ -0,0 +1,38 @@
+# Copyright (c) 2015, Euen Lopez <[email protected]>
+# This file is part of erlang.mk and subject to the terms of the ISC License.
+
+.PHONY: xref distclean-xref
+
+# Configuration.
+
+ifeq ($(XREF_CONFIG),)
+ XREF_ARGS :=
+else
+ XREF_ARGS := -c $(XREF_CONFIG)
+endif
+
+XREFR ?= $(CURDIR)/xrefr
+export XREFR
+
+XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/0.2.0/xrefr
+
+# Core targets.
+
+help::
+ @printf "%s\n" "" \
+ "Xref targets:" \
+ " xref Run Xrefr using $XREF_CONFIG as config file if defined"
+
+distclean:: distclean-xref
+
+# Plugin-specific targets.
+
+$(XREFR):
+ @$(call core_http_get,$(XREFR),$(XREFR_URL))
+ @chmod +x $(XREFR)
+
+xref: deps app $(XREFR)
+ $(gen_verbose) $(XREFR) $(XREFR_ARGS)
+
+distclean-xref:
+ $(gen_verbose) rm -rf $(XREFR)