po4a_manpage.mak 1.7 KB

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