edoc.mk 966 B

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. .PHONY: distclean-edoc edoc
  4. # Configuration.
  5. EDOC_OPTS ?=
  6. EDOC_SRC_DIRS ?=
  7. EDOC_OUTPUT ?= doc
  8. define edoc.erl
  9. SrcPaths = lists:foldl(fun(P, Acc) ->
  10. filelib:wildcard(atom_to_list(P) ++ "/{src,c_src}") ++ Acc
  11. end, [], [$(call comma_list,$(patsubst %,'%',$(EDOC_SRC_DIRS)))]),
  12. DefaultOpts = [{dir, "$(EDOC_OUTPUT)"}, {source_path, SrcPaths}, {subpackages, false}],
  13. edoc:application($(1), ".", [$(2)] ++ DefaultOpts),
  14. halt(0).
  15. endef
  16. # Core targets.
  17. ifneq ($(strip $(EDOC_SRC_DIRS)$(wildcard doc/overview.edoc)),)
  18. docs:: edoc
  19. endif
  20. distclean:: distclean-edoc
  21. # Plugin-specific targets.
  22. edoc: distclean-edoc doc-deps
  23. $(gen_verbose) $(call erlang,$(call edoc.erl,$(PROJECT),$(EDOC_OPTS)))
  24. distclean-edoc:
  25. $(gen_verbose) rm -f $(EDOC_OUTPUT)/*.css $(EDOC_OUTPUT)/*.html $(EDOC_OUTPUT)/*.png $(EDOC_OUTPUT)/edoc-info