po4a_manpage.mak 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. # Do not use XMLTO, build the manpages directly with XSLTPROC
  12. ifdef XSLTPROC
  13. STYLESHEET=manpage-style.xsl
  14. LOCAL := po4a-manpage-$(firstword $(SOURCE))
  15. $(LOCAL)-LIST := $(SOURCE)
  16. # Install generation hooks
  17. doc: $($(LOCAL)-LIST)
  18. veryclean: veryclean/$(LOCAL)
  19. apt-verbatim.ent: ../apt-verbatim.ent
  20. cp ../apt-verbatim.ent .
  21. manpage-style.xsl: ../manpage-style.xsl
  22. sed "/<!-- LANGUAGE -->/ i\
  23. <xsl:param name=\"l10n.gentext.default.language\" select=\"'$(LC)'\" />" ../manpage-style.xsl > manpage-style.xsl
  24. $($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
  25. echo Creating man page $@
  26. $(XSLTPROC) -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here???
  27. test -f $(subst .$(LC),,$@) || echo FIXME: xsltproc respect the -o flag now, workaround can be removed
  28. mv -f $(subst .$(LC),,$@) $@
  29. # Clean rule
  30. .PHONY: veryclean/$(LOCAL)
  31. veryclean/$(LOCAL):
  32. -rm -rf $($(@F)-LIST) apt.ent apt-verbatim.ent apt.$(LC).8 \
  33. $(addsuffix .xml,$($(@F)-LIST)) \
  34. offline.$(LC).sgml guide.$(LC).sgml
  35. HAVE_PO4A=yes
  36. endif
  37. # take care of the rest
  38. SOURCE := $(SOURCE) $(wildcard apt.$(LC).8)
  39. INCLUDES :=
  40. ifndef HAVE_PO4A
  41. # Strip from the source list any man pages we dont have compiled already
  42. SOURCE := $(wildcard $(SOURCE))
  43. endif
  44. # Chain to the manpage rule
  45. ifneq ($(words $(SOURCE)),0)
  46. include $(MANPAGE_H)
  47. endif
  48. # Debian Doc SGML Documents
  49. SOURCE := $(wildcard *.$(LC).sgml)
  50. DEBIANDOC_HTML_OPTIONS=-l $(LC).UTF-8
  51. include $(DEBIANDOC_H)