Makefile 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. include ../../../scripts/Makefile.include
  2. include ../../../scripts/utilities.mak
  3. INSTALL ?= install
  4. RM ?= rm -f
  5. RMDIR ?= rmdir --ignore-fail-on-non-empty
  6. ifeq ($(V),1)
  7. Q =
  8. else
  9. Q = @
  10. endif
  11. prefix ?= /usr/local
  12. mandir ?= $(prefix)/man
  13. man8dir = $(mandir)/man8
  14. MAN8_RST = $(wildcard *.rst)
  15. _DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST))
  16. DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
  17. man: man8
  18. man8: $(DOC_MAN8)
  19. RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
  20. $(OUTPUT)%.8: %.rst
  21. ifndef RST2MAN_DEP
  22. $(error "rst2man not found, but required to generate man pages")
  23. endif
  24. $(QUIET_GEN)rst2man $< > $@
  25. clean:
  26. $(call QUIET_CLEAN, Documentation)
  27. $(Q)$(RM) $(DOC_MAN8)
  28. install: man
  29. $(call QUIET_INSTALL, Documentation-man)
  30. $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
  31. $(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
  32. uninstall:
  33. $(call QUIET_UNINST, Documentation-man)
  34. $(Q)$(RM) $(addprefix $(DESTDIR)$(man8dir)/,$(_DOC_MAN8))
  35. $(Q)$(RMDIR) $(DESTDIR)$(man8dir)
  36. .PHONY: man man8 clean install uninstall
  37. .DEFAULT_GOAL := man