manual.mk 2.5 KB

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