po4a_manpage.mak 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # -*- make -*-
  2. # This handles man pages with po4a. We convert to the respective
  3. # output in the source directory then copy over to the final dest. This
  4. # means po4a is only needed if compiling from bzr
  5. # Input
  6. # $(LC) - The language code of the translation
  7. # See defaults.mak for information about LOCAL
  8. # generate a list of accepted man page translations
  9. SOURCE = $(patsubst %.xml,%,$(wildcard *.$(LC).?.xml))
  10. INCLUDES = apt.ent apt-verbatim.ent apt-vendor.ent
  11. manpages:
  12. # Do not use XMLTO, build the manpages directly with XSLTPROC
  13. ifdef XSLTPROC
  14. STYLESHEET=manpage-style.xsl
  15. LOCAL := po4a-manpage-$(firstword $(SOURCE))
  16. $(LOCAL)-LIST := $(SOURCE)
  17. # Install generation hooks
  18. manpages: $($(LOCAL)-LIST)
  19. clean: clean/$(LOCAL)
  20. veryclean: veryclean/$(LOCAL)
  21. apt-verbatim.ent: ../apt-verbatim.ent
  22. cp -a ../apt-verbatim.ent .
  23. apt-vendor.ent: ../apt-vendor.ent
  24. cp -a ../apt-vendor.ent .
  25. manpage-style.xsl: ../manpage-style.xsl
  26. sed "/<!-- LANGUAGE -->/ i\
  27. <xsl:param name=\"l10n.gentext.default.language\" select=\"'$(LC)'\" />" ../manpage-style.xsl > manpage-style.xsl
  28. $($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
  29. echo Creating man page $@
  30. $(XSLTPROC) -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here???
  31. test -f $(subst .$(LC),,$@) || echo 'FIXME: xsltproc respects the -o flag now, workaround can be removed'
  32. mv -f $(subst .$(LC),,$@) $@
  33. # Clean rule
  34. .PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
  35. clean/$(LOCAL):
  36. rm -f $($(@F)-LIST) apt.ent apt-verbatim.ent
  37. veryclean/$(LOCAL):
  38. # we are nuking the directory we are working in as it is auto-generated
  39. rm -rf $(shell readlink -f .)
  40. HAVE_PO4A=yes
  41. endif
  42. # take care of the rest
  43. SOURCE := $(SOURCE) $(wildcard apt.$(LC).8)
  44. INCLUDES :=
  45. ifndef HAVE_PO4A
  46. # Strip from the source list any man pages we dont have compiled already
  47. SOURCE := $(wildcard $(SOURCE))
  48. endif
  49. # Chain to the manpage rule
  50. ifneq ($(words $(SOURCE)),0)
  51. include $(MANPAGE_H)
  52. endif
  53. # Debian Doc SGML Documents
  54. SOURCE := $(wildcard *.$(LC).sgml)
  55. DEBIANDOC_HTML_OPTIONS=-l $(LC).UTF-8
  56. include $(DEBIANDOC_H)