po4a_manpage.mak 1.6 KB

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