po4a_manpage.mak 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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
  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 ../apt-verbatim.ent .
  23. manpage-style.xsl: ../manpage-style.xsl
  24. sed "/<!-- LANGUAGE -->/ i\
  25. <xsl:param name=\"l10n.gentext.default.language\" select=\"'$(LC)'\" />" ../manpage-style.xsl > manpage-style.xsl
  26. $($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
  27. echo Creating man page $@
  28. $(XSLTPROC) -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here???
  29. test -f $(subst .$(LC),,$@) || echo 'FIXME: xsltproc respects the -o flag now, workaround can be removed'
  30. mv -f $(subst .$(LC),,$@) $@
  31. # Clean rule
  32. .PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
  33. clean/$(LOCAL):
  34. rm -f $($(@F)-LIST) apt.ent apt-verbatim.ent
  35. veryclean/$(LOCAL):
  36. # we are nuking the directory we are working in as it is auto-generated
  37. rm -rf $(shell readlink -f .)
  38. HAVE_PO4A=yes
  39. endif
  40. # take care of the rest
  41. SOURCE := $(SOURCE) $(wildcard apt.$(LC).8)
  42. INCLUDES :=
  43. ifndef HAVE_PO4A
  44. # Strip from the source list any man pages we dont have compiled already
  45. SOURCE := $(wildcard $(SOURCE))
  46. endif
  47. # Chain to the manpage rule
  48. ifneq ($(words $(SOURCE)),0)
  49. include $(MANPAGE_H)
  50. endif
  51. # Debian Doc SGML Documents
  52. SOURCE := $(wildcard *.$(LC).sgml)
  53. DEBIANDOC_HTML_OPTIONS=-l $(LC).UTF-8
  54. include $(DEBIANDOC_H)