po4a_manpage.mak 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 '$(abspath .)'
  41. HAVE_PO4A=yes
  42. endif
  43. # take care of the rest
  44. INCLUDES :=
  45. ifndef HAVE_PO4A
  46. # Strip from the source list any man pages we don't 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. # DocBook XML Documents
  54. SOURCE := $(wildcard *.$(LC).dbk)
  55. include $(DOCBOOK_H)