From ddca43cbb6b0ec3d2110a59a1571f9522e3b8e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= Date: Sat, 10 Jan 2015 17:09:35 +0100 Subject: Adds DOC_DEPS; fixes #75 --- erlang.mk | 12 ++++++++++-- plugins/edoc.mk | 12 ++++++++++-- test/Makefile | 28 +++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/erlang.mk b/erlang.mk index 73948a7..dca0aca 100644 --- a/erlang.mk +++ b/erlang.mk @@ -869,9 +869,10 @@ endif @dialyzer --no_native $(DIALYZER_DIRS) $(DIALYZER_OPTS) # Copyright (c) 2013-2014, Loïc Hoguin +# Copyright (c) 2015, Viktor Söderqvist # 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. @@ -879,13 +880,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 +# Copyright (c) 2015, Viktor Söderqvist # 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 619c3e5..c387081 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 '+---------------------+' @@ -99,7 +99,6 @@ ct: app1 eunit: app1 $i "eunit: Testing the 'eunit' target." - $t mkdir -p eunit $i "Running eunit test case inside module src/t.erl" $t printf '%s\n' \ '-module(t).' \ @@ -148,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." -- cgit v1.2.3