manual.mk 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ################################################################################
  2. # GENDOC -- generates the make targets needed to build a specific type of
  3. # asciidoc documentation.
  4. #
  5. # argument 1 is the name of the document and must be a subdirectory of docs/;
  6. # the top-level asciidoc file must have the same name
  7. # argument 2 is the type of document to generate (-f argument of a2x)
  8. # argument 3 is the document type as used in the make target
  9. # argument 4 is the output file extension for the document type
  10. # argument 5 is the human text for the document type
  11. # argument 6 (optional) are extra arguments for a2x
  12. #
  13. # The variable <DOCUMENT_NAME>_SOURCES defines the dependencies.
  14. ################################################################################
  15. define GENDOC_INNER
  16. $(1): $(1)-$(3)
  17. .PHONY: $(1)-$(3)
  18. $(1)-$(3): $$(O)/docs/$(1)/$(1).$(4)
  19. $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt $$($(call UPPERCASE,$(1))_SOURCES)
  20. @echo "Generating $(5) $(1)..."
  21. $(Q)mkdir -p $$(@D)
  22. $(Q)a2x $(6) -f $(2) -d book -L -r $(TOPDIR)/docs/images \
  23. -D $$(@D) $$<
  24. endef
  25. ################################################################################
  26. # GENDOC -- generates the make targets needed to build asciidoc documentation.
  27. #
  28. # argument 1 is the name of the document and must be a subdirectory of docs/;
  29. # the top-level asciidoc file must have the same name
  30. #
  31. # The variable <DOCUMENT_NAME>_SOURCES defines the dependencies.
  32. ################################################################################
  33. define GENDOC
  34. $(call GENDOC_INNER,$(1),xhtml,html,html,HTML,--xsltproc-opts "--stringparam toc.section.depth 4")
  35. $(call GENDOC_INNER,$(1),chunked,split-html,chunked,Split HTML,--xsltproc-opts "--stringparam toc.section.depth 4")
  36. $(call GENDOC_INNER,$(1),pdf,pdf,pdf,PDF,--dblatex-opts "-P latex.output.revhistory=0")
  37. $(call GENDOC_INNER,$(1),text,txt,text,Text)
  38. $(call GENDOC_INNER,$(1),epub,epub,epub,EPUB)
  39. clean: $(1)-clean
  40. $(1)-clean:
  41. $(Q)$(RM) -rf $(O)/docs/$(1)
  42. .PHONY: $(1) $(1)-clean
  43. endef
  44. MANUAL_SOURCES = $(wildcard docs/manual/*.txt) $(wildcard docs/images/*)
  45. $(eval $(call GENDOC,manual))