aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/asciidoc.mk46
-rw-r--r--plugins/ci.mk65
-rw-r--r--plugins/cover.mk6
-rw-r--r--plugins/ct.mk10
-rw-r--r--plugins/dialyzer.mk2
-rw-r--r--plugins/edoc.mk14
-rw-r--r--plugins/eunit.mk2
-rw-r--r--plugins/relx.mk2
-rw-r--r--plugins/shell.mk2
-rw-r--r--plugins/triq.mk2
-rw-r--r--plugins/xref.mk38
11 files changed, 168 insertions, 21 deletions
diff --git a/plugins/asciidoc.mk b/plugins/asciidoc.mk
new file mode 100644
index 0000000..baf4d3b
--- /dev/null
+++ b/plugins/asciidoc.mk
@@ -0,0 +1,46 @@
+# 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: asciidoc asciidoc-guide asciidoc-manual install-asciidoc distclean-asciidoc
+
+MAN_INSTALL_PATH ?= /usr/local/share/man
+MAN_SECTIONS ?= 3 7
+
+docs:: asciidoc
+
+asciidoc: distclean-asciidoc doc-deps asciidoc-guide asciidoc-manual
+
+ifeq ($(wildcard doc/src/guide/book.asciidoc),)
+asciidoc-guide:
+else
+asciidoc-guide:
+ a2x -v -f pdf doc/src/guide/book.asciidoc && mv doc/src/guide/book.pdf doc/guide.pdf
+ a2x -v -f chunked doc/src/guide/book.asciidoc && mv doc/src/guide/book.chunked/ doc/html/
+endif
+
+ifeq ($(wildcard doc/src/manual/*.asciidoc),)
+asciidoc-manual:
+else
+asciidoc-manual:
+ for f in doc/src/manual/*.asciidoc ; do \
+ a2x -v -f manpage $$f ; \
+ done
+ for s in $(MAN_SECTIONS); do \
+ mkdir -p doc/man$$s/ ; \
+ mv doc/src/manual/*.$$s doc/man$$s/ ; \
+ gzip doc/man$$s/*.$$s ; \
+ done
+
+install-docs:: install-asciidoc
+
+install-asciidoc: asciidoc-manual
+ for s in $(MAN_SECTIONS); do \
+ mkdir -p $(MAN_INSTALL_PATH)/man$$s/ ; \
+ install -g 0 -o 0 -m 0644 doc/man$$s/*.gz $(MAN_INSTALL_PATH)/man$$s/ ; \
+ done
+endif
+
+distclean:: distclean-asciidoc
+
+distclean-asciidoc:
+ $(gen_verbose) rm -rf doc/html/ doc/guide.pdf doc/man3/ doc/man7/
diff --git a/plugins/ci.mk b/plugins/ci.mk
new file mode 100644
index 0000000..e5df48e
--- /dev/null
+++ b/plugins/ci.mk
@@ -0,0 +1,65 @@
+# 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: ci ci-setup distclean-kerl
+
+KERL ?= $(CURDIR)/kerl
+export KERL
+
+KERL_URL ?= https://raw.githubusercontent.com/yrashk/kerl/master/kerl
+
+OTP_GIT ?= https://github.com/erlang/otp
+
+CI_INSTALL_DIR ?= $(HOME)/erlang
+CI_OTP ?=
+
+ifeq ($(strip $(CI_OTP)),)
+ci::
+else
+ci:: $(KERL) $(addprefix ci-,$(CI_OTP))
+
+ci-setup::
+
+ci_verbose_0 = @echo " CI " $(1);
+ci_verbose = $(ci_verbose_$(V))
+
+define ci_target
+ci-$(1): $(CI_INSTALL_DIR)/$(1)
+ -$(ci_verbose) \
+ PATH="$(CI_INSTALL_DIR)/$(1)/bin:$(PATH)" \
+ CI_OTP_RELEASE="$(1)" \
+ CT_OPTS="-label $(1)" \
+ $(MAKE) clean ci-setup tests
+endef
+
+$(foreach otp,$(CI_OTP),$(eval $(call ci_target,$(otp))))
+
+define ci_otp_target
+$(CI_INSTALL_DIR)/$(1):
+ $(KERL) build git $(OTP_GIT) $(1) $(1)
+ $(KERL) install $(1) $(CI_INSTALL_DIR)/$(1)
+endef
+
+$(foreach otp,$(CI_OTP),$(eval $(call ci_otp_target,$(otp))))
+
+define kerl_fetch
+ $(call core_http_get,$(KERL),$(KERL_URL))
+ chmod +x $(KERL)
+endef
+
+$(KERL):
+ @$(call kerl_fetch)
+
+help::
+ @printf "%s\n" "" \
+ "Continuous Integration targets:" \
+ " ci Run 'make tests' on all configured Erlang versions." \
+ "" \
+ "The CI_OTP variable must be defined with the Erlang versions" \
+ "that must be tested. For example: CI_OTP = OTP-17.3.4 OTP-17.5.3"
+
+distclean:: distclean-kerl
+
+distclean-kerl:
+ $(gen_verbose) rm -rf $(KERL)
+endif
diff --git a/plugins/cover.mk b/plugins/cover.mk
index b42311e..3397dca 100644
--- a/plugins/cover.mk
+++ b/plugins/cover.mk
@@ -29,15 +29,15 @@ ifdef CT_RUN
# All modules in 'ebin'
COVER_MODS = $(notdir $(basename $(shell echo ebin/*.beam)))
-test-build:: ct.cover.spec
+test-build:: $(TEST_DIR)/ct.cover.spec
-ct.cover.spec:
+$(TEST_DIR)/ct.cover.spec:
@echo Cover mods: $(COVER_MODS)
$(gen_verbose) printf "%s\n" \
'{incl_mods,[$(subst $(space),$(comma),$(COVER_MODS))]}.' \
'{export,"$(CURDIR)/ct.coverdata"}.' > $@
-CT_RUN += -cover ct.cover.spec
+CT_RUN += -cover $(TEST_DIR)/ct.cover.spec
endif
endif
diff --git a/plugins/ct.mk b/plugins/ct.mk
index 27921dc..eba0e52 100644
--- a/plugins/ct.mk
+++ b/plugins/ct.mk
@@ -31,25 +31,25 @@ help::
CT_RUN = ct_run \
-no_auto_compile \
-noinput \
- -pa ebin $(DEPS_DIR)/*/ebin \
+ -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin $(TEST_DIR) \
-dir $(TEST_DIR) \
- -logdir logs
+ -logdir $(CURDIR)/logs
ifeq ($(CT_SUITES),)
ct:
else
ct: test-build
- @mkdir -p logs/
+ @mkdir -p $(CURDIR)/logs/
$(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS)
endif
define ct_suite_target
ct-$(1): test-build
- @mkdir -p logs/
+ @mkdir -p $(CURDIR)/logs/
$(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_OPTS)
endef
$(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test))))
distclean-ct:
- $(gen_verbose) rm -rf logs/
+ $(gen_verbose) rm -rf $(CURDIR)/logs/
diff --git a/plugins/dialyzer.mk b/plugins/dialyzer.mk
index 530f809..23d16ee 100644
--- a/plugins/dialyzer.mk
+++ b/plugins/dialyzer.mk
@@ -15,6 +15,8 @@ DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions \
# Core targets.
+check:: dialyze
+
distclean:: distclean-plt
help::
diff --git a/plugins/edoc.mk b/plugins/edoc.mk
index d9b1d70..6f0a82d 100644
--- a/plugins/edoc.mk
+++ b/plugins/edoc.mk
@@ -1,8 +1,7 @@
# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]>
-# Copyright (c) 2015, Viktor Söderqvist <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.
-.PHONY: distclean-edoc build-doc-deps
+.PHONY: distclean-edoc edoc
# Configuration.
@@ -10,19 +9,14 @@ EDOC_OPTS ?=
# Core targets.
-docs:: distclean-edoc build-doc-deps
- $(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().'
+docs:: distclean-edoc edoc
distclean:: distclean-edoc
# Plugin-specific targets.
-DOC_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(DOC_DEPS))
-
-$(foreach dep,$(DOC_DEPS),$(eval $(call dep_target,$(dep))))
-
-build-doc-deps: $(DOC_DEPS_DIRS)
- @for dep in $(DOC_DEPS_DIRS) ; do $(MAKE) -C $$dep; done
+edoc: doc-deps
+ $(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().'
distclean-edoc:
$(gen_verbose) rm -f doc/*.css doc/*.html doc/*.png doc/edoc-info
diff --git a/plugins/eunit.mk b/plugins/eunit.mk
index b1ebe43..b9f2856 100644
--- a/plugins/eunit.mk
+++ b/plugins/eunit.mk
@@ -20,7 +20,7 @@ EUNIT_EBIN_MODS = $(notdir $(basename $(shell find ebin -type f -name *.beam)))
EUNIT_MODS = $(filter-out $(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(TEST_DIR_MODS))
TAGGED_EUNIT_TESTS = $(foreach mod,$(EUNIT_EBIN_MODS) $(EUNIT_MODS),{module,$(mod)})
-EUNIT_OPTS ?= verbose
+EUNIT_OPTS ?=
# Utility functions
diff --git a/plugins/relx.mk b/plugins/relx.mk
index 9a0e134..43f3d69 100644
--- a/plugins/relx.mk
+++ b/plugins/relx.mk
@@ -10,7 +10,7 @@ RELX_CONFIG ?= $(CURDIR)/relx.config
RELX ?= $(CURDIR)/relx
export RELX
-RELX_URL ?= https://github.com/erlware/relx/releases/download/v1.1.0/relx
+RELX_URL ?= https://github.com/erlware/relx/releases/download/v2.0.0/relx
RELX_OPTS ?=
RELX_OUTPUT_DIR ?= _rel
diff --git a/plugins/shell.mk b/plugins/shell.mk
index 4e7e97e..6636b92 100644
--- a/plugins/shell.mk
+++ b/plugins/shell.mk
@@ -15,7 +15,7 @@ ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS))
help::
@printf "%s\n" "" \
"Shell targets:" \
- " shell Run an erlang shell with SHELL_OPTS or reasonable default"
+ " shell Run an erlang shell with SHELL_OPTS or reasonable default"
# Plugin-specific targets.
diff --git a/plugins/triq.mk b/plugins/triq.mk
index 8a77c91..2edfdba 100644
--- a/plugins/triq.mk
+++ b/plugins/triq.mk
@@ -1,6 +1,7 @@
# Copyright (c) 2015, Loïc Hoguin <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.
+ifneq ($(wildcard $(DEPS_DIR)/triq),)
.PHONY: triq
# Targets.
@@ -27,3 +28,4 @@ triq: test-build
| sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//'))
$(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
endif
+endif
diff --git a/plugins/xref.mk b/plugins/xref.mk
new file mode 100644
index 0000000..b6e4d92
--- /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)