po4a_manpage.mak 1.9 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. %.xsl: ../%.xsl
  13. cp -a $< .
  14. # Do not use XMLTO, build the manpages directly with XSLTPROC
  15. ifdef XSLTPROC
  16. STYLESHEET=manpage-style.xsl
  17. LOCAL := po4a-manpage-$(firstword $(SOURCE))
  18. $(LOCAL)-LIST := $(SOURCE)
  19. # Install generation hooks
  20. manpages: $($(LOCAL)-LIST)
  21. clean: clean/$(LOCAL)
  22. veryclean: veryclean/$(LOCAL)
  23. apt-verbatim.ent: ../apt-verbatim.ent
  24. cp -a ../apt-verbatim.ent .
  25. apt-vendor.ent: ../apt-vendor.ent
  26. cp -a ../apt-vendor.ent .
  27. $($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
  28. echo Creating man page $@
  29. $(XSLTPROC) \
  30. --stringparam l10n.gentext.default.language $(LC) \
  31. -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here???
  32. test -f $(subst .$(LC),,$@) || echo 'FIXME: xsltproc respects the -o flag now, workaround can be removed'
  33. mv -f $(subst .$(LC),,$@) $@
  34. # Clean rule
  35. .PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
  36. clean/$(LOCAL):
  37. rm -f $($(@F)-LIST) apt.ent apt-verbatim.ent
  38. veryclean/$(LOCAL):
  39. # we are nuking the directory we are working in as it is auto-generated
  40. rm -rf $(shell readlink -f .)
  41. HAVE_PO4A=yes
  42. endif
  43. # take care of the rest
  44. SOURCE := $(SOURCE) $(wildcard apt.$(LC).8)
  45. INCLUDES :=
  46. ifndef HAVE_PO4A
  47. # Strip from the source list any man pages we dont have compiled already
  48. SOURCE := $(wildcard $(SOURCE))
  49. endif
  50. # Chain to the manpage rule
  51. ifneq ($(words $(SOURCE)),0)
  52. include $(MANPAGE_H)
  53. endif
  54. # DocBook XML Documents
  55. SOURCE := $(wildcard *.$(LC).dbk)
  56. include $(DOCBOOK_H)