po4a_manpage.mak 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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) $< # why xsltproc doesn't respect the -o flag here???
  22. mv -f $(subst .$(LC),,$@) $@
  23. # Clean rule
  24. .PHONY: veryclean/$(LOCAL)
  25. veryclean/$(LOCAL):
  26. -rm -rf $($(@F)-LIST) apt.ent apt.$(LC).8 \
  27. $(addsuffix .xml,$($(@F)-LIST))
  28. HAVE_PO4A=yes
  29. endif
  30. # take care of the rest
  31. SOURCE := $(SOURCE) apt.$(LC).8
  32. INCLUDES :=
  33. ifndef HAVE_PO4A
  34. # Strip from the source list any man pages we dont have compiled already
  35. SOURCE := $(wildcard $(SOURCE))
  36. endif
  37. # Chain to the manpage rule
  38. ifneq ($(words $(SOURCE)),0)
  39. include $(MANPAGE_H)
  40. endif