Browse Source

add as a plugin

Euen 10 years ago
parent
commit
5451df8416
3 changed files with 78 additions and 0 deletions
  1. 1 0
      build.config
  2. 39 0
      erlang.mk
  3. 38 0
      plugins/xref.mk

+ 1 - 0
build.config

@@ -22,3 +22,4 @@ plugins/eunit
 plugins/relx
 plugins/shell
 plugins/triq
+plugins/xref

+ 39 - 0
erlang.mk

@@ -1273,3 +1273,42 @@ triq: test-build
 	$(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
 endif
 endif
+
+# Copyright (c) 2015, Euen Lopez <euen@inakanetworks.com>
+# 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)

+ 38 - 0
plugins/xref.mk

@@ -0,0 +1,38 @@
+# Copyright (c) 2015, Euen Lopez <euen@inakanetworks.com>
+# 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)