Просмотр исходного кода

Merge branch 'doc-deps' of https://github.com/zuiderkwast/erlang.mk

Loïc Hoguin 10 лет назад
Родитель
Сommit
2f177ad173
3 измененных файлов с 45 добавлено и 6 удалено
  1. 10 2
      erlang.mk
  2. 10 2
      plugins/edoc.mk
  3. 25 2
      test/Makefile

+ 10 - 2
erlang.mk

@@ -947,9 +947,10 @@ endif
 	@dialyzer --no_native $(DIALYZER_DIRS) $(DIALYZER_OPTS)
 
 # Copyright (c) 2013-2014, Loïc Hoguin <essen@ninenines.eu>
+# Copyright (c) 2015, Viktor Söderqvist <viktor@zuiderkwast.se>
 # 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
 

+ 10 - 2
plugins/edoc.mk

@@ -1,7 +1,8 @@
 # Copyright (c) 2013-2014, Loïc Hoguin <essen@ninenines.eu>
+# Copyright (c) 2015, Viktor Söderqvist <viktor@zuiderkwast.se>
 # 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

+ 25 - 2
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."