po4a_manpage.mak 1.9 KB

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