aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erlang.mk12
-rw-r--r--plugins/edoc.mk12
-rw-r--r--test/Makefile27
3 files changed, 45 insertions, 6 deletions
diff --git a/erlang.mk b/erlang.mk
index 5ac12d8..6faa659 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -947,9 +947,10 @@ endif
@dialyzer --no_native $(DIALYZER_DIRS) $(DIALYZER_OPTS)
# Copyright (c) 2013-2014, 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
+.PHONY: distclean-edoc build-doc-deps
# Configuration.
@@ -957,13 +958,20 @@ EDOC_OPTS ?=
# Core targets.
-docs:: distclean-edoc
+docs:: distclean-edoc build-doc-deps
$(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().'
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
+
distclean-edoc:
$(gen_verbose) rm -f doc/*.css doc/*.html doc/*.png doc/edoc-info
diff --git a/plugins/edoc.mk b/plugins/edoc.mk
index 3f94c43..573ce05 100644
--- a/plugins/edoc.mk
+++ b/plugins/edoc.mk
@@ -1,7 +1,8 @@
# Copyright (c) 2013-2014, 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
+.PHONY: distclean-edoc build-doc-deps
# Configuration.
@@ -9,12 +10,19 @@ EDOC_OPTS ?=
# Core targets.
-docs:: distclean-edoc
+docs:: distclean-edoc build-doc-deps
$(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().'
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
+
distclean-edoc:
$(gen_verbose) rm -f doc/*.css doc/*.html doc/*.png doc/edoc-info
diff --git a/test/Makefile b/test/Makefile
index aec10c1..265c67c 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -33,9 +33,9 @@ else
i = @echo ==
endif
-.PHONY: all clean app ct eunit
+.PHONY: all clean app ct eunit docs
-all: app ct eunit clean
+all: app ct eunit docs clean
$i '+---------------------+'
$i '| All tests passed. |'
$i '+---------------------+'
@@ -147,6 +147,29 @@ eunit: app1
$t rm -rf app1/eunit app1/src/t.erl app1/test-eunit.log
$i "Test 'eunit' passed."
+docs: app1
+ $i "docs: Testing EDoc including DOC_DEPS."
+ $t printf "%s\n" \
+ "PROJECT = app1" \
+ "DOC_DEPS = edown" \
+ "dep_edown = git https://github.com/uwiger/edown.git 0.5" \
+ "EDOC_OPTS = {doclet, edown_doclet}" \
+ "include erlang.mk" \
+ "distclean:: distclean-doc-md" \
+ "distclean-doc-md:" \
+ " rm -rf doc/*.md" \
+ > app1/Makefile-doc
+ $i "Downloading doc deps (edown) and building docs."
+ $t make -C app1 -f Makefile-doc docs $v
+ $i "Checking that 'make docs' using edown generated a markdown file."
+ $t [ -e app1/doc/m.md ]
+ $i "Checking that 'make distclean' deletes all generated doc files."
+ $t make -C app1 -f Makefile-doc distclean $v
+ $t [ "`ls app1/doc/`" == "" ]
+ $i "Cleaning up test data."
+ $t rm app1/Makefile-doc
+ $i "Test 'docs' passed."
+
# Test application used for testing.
app1:
$i "Setting up app."