docbook.mak 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # -*- make -*-
  2. # This processes DocBook XML to produce html and plain text output
  3. # Input
  4. # $(SOURCE) - The documents to use
  5. # All output is written to files in the build doc directory
  6. # See defaults.mak for information about LOCAL
  7. # Some local definitions
  8. LOCAL := docbook-$(firstword $(SOURCE))
  9. $(LOCAL)-HTML := $(addsuffix .html,$(addprefix $(DOC)/,$(basename $(SOURCE))))
  10. $(LOCAL)-TEXT := $(addsuffix .text,$(addprefix $(DOC)/,$(basename $(SOURCE))))
  11. INCLUDES = apt.ent apt-verbatim.ent apt-vendor.ent
  12. docbook:
  13. #---------
  14. # Rules to build HTML documentations
  15. ifdef XSLTPROC
  16. DOCBOOK_HTML_STYLESHEET := docbook-html-style.xsl
  17. # Install generation hooks
  18. docbook: $($(LOCAL)-HTML)
  19. veryclean: veryclean/html/$(LOCAL)
  20. vpath %.dbk $(SUBDIRS)
  21. vpath $(DOCBOOK_HTML_STYLESHEET) $(SUBDIRS)
  22. $(DOC)/%.html: %.dbk $(DOCBOOK_HTML_STYLESHEET) $(INCLUDES)
  23. echo Creating html for $< to $@
  24. -rm -rf $@
  25. mkdir -p $@
  26. $(DOCBOOK) \
  27. --stringparam base.dir $@/ \
  28. --stringparam l10n.gentext.default.language $(LC) \
  29. $(<D)/$(DOCBOOK_HTML_STYLESHEET) $< || exit 199
  30. # Clean rule
  31. .PHONY: veryclean/html/$(LOCAL)
  32. veryclean/html/$(LOCAL):
  33. -rm -rf $($(@F)-HTML)
  34. endif
  35. #---------
  36. # Rules to build Text documentations
  37. ifdef XSLTPROC
  38. DOCBOOK_TEXT_STYLESHEET := docbook-text-style.xsl
  39. # Install generation hooks
  40. docbook: $($(LOCAL)-TEXT)
  41. veryclean: veryclean/text/$(LOCAL)
  42. vpath %.dbk $(SUBDIRS)
  43. vpath $(DOCBOOK_TEXT_STYLESHEET) $(SUBDIRS)
  44. $(DOC)/%.text: %.dbk $(DOCBOOK_TEXT_STYLESHEET) $(INCLUDES)
  45. echo Creating text for $< to $@
  46. $(DOCBOOK) \
  47. --stringparam l10n.gentext.default.language $(LC) \
  48. $(<D)/$(DOCBOOK_TEXT_STYLESHEET) $< | \
  49. LC_ALL=C.UTF-8 $(DOCBOOK2TEXT) > $@ || exit 198
  50. # Clean rule
  51. .PHONY: veryclean/text/$(LOCAL)
  52. veryclean/text/$(LOCAL):
  53. -rm -rf $($(@F)-TEXT)
  54. endif