Browse Source

edoc: apps to generate doc for default to ALL_APPS_DIRS + ALL_DEPS_DIRS

'source_path' property of edoc default to the list of explicit deps and apps
Can be overriden with EDOC_SRC_DIRS

In general, edoc options can be overriden with EDOC_OPTS, à la proplists

'source_path' edoc property is not recursive: look for source code in 'src' and 'c_src'
Jean Parpaillon 9 years ago
parent
commit
613410e9d6
1 changed files with 16 additions and 6 deletions
  1. 16 6
      plugins/edoc.mk

+ 16 - 6
plugins/edoc.mk

@@ -6,19 +6,29 @@
 # Configuration.
 # Configuration.
 
 
 EDOC_OPTS ?=
 EDOC_OPTS ?=
+EDOC_SRC_DIRS ?= $(ALL_APPS_DIRS) $(ALL_DEPS_DIRS)
+
+# TODO: use double-quote instead of single + atom_to_list
+#       The problem is in correctly escaping double-quotes
+define edoc.erl
+	SrcPaths = lists:foldl(fun (P, Acc) ->
+	                         filelib:wildcard(atom_to_list(P) ++ "/{src,c_src}") ++ Acc
+	                       end, [], [$(call comma_list,$(patsubst %,'%',$(EDOC_SRC_DIRS)))]),
+	DefaultOpts = [ {source_path, SrcPaths}
+	               ,{subpackages, false} ],
+	edoc:application($(1), ".", [$(2)] ++ DefaultOpts),
+	halt(0).
+endef
 
 
 # Core targets.
 # Core targets.
-
-ifneq ($(wildcard doc/overview.edoc),)
-docs:: edoc
-endif
+docs:: distclean-edoc edoc
 
 
 distclean:: distclean-edoc
 distclean:: distclean-edoc
 
 
 # Plugin-specific targets.
 # Plugin-specific targets.
 
 
-edoc: distclean-edoc doc-deps
-	$(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().'
+edoc: doc-deps
+	$(gen_verbose) $(call erlang,$(call edoc.erl,$(PROJECT),$(EDOC_OPTS)))
 
 
 distclean-edoc:
 distclean-edoc:
 	$(gen_verbose) rm -f doc/*.css doc/*.html doc/*.png doc/edoc-info
 	$(gen_verbose) rm -f doc/*.css doc/*.html doc/*.png doc/edoc-info