Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. # Load targets for building eBPF helpers man page.
  15. include ../../Makefile.helpers
  16. MAN8_RST = $(filter-out $(HELPERS_RST),$(wildcard *.rst))
  17. _DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST))
  18. DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
  19. man: man8 helpers
  20. man8: $(DOC_MAN8)
  21. RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
  22. $(OUTPUT)%.8: %.rst
  23. ifndef RST2MAN_DEP
  24. $(error "rst2man not found, but required to generate man pages")
  25. endif
  26. $(QUIET_GEN)rst2man $< > $@
  27. clean: helpers-clean
  28. $(call QUIET_CLEAN, Documentation)
  29. $(Q)$(RM) $(DOC_MAN8)
  30. install: man helpers-install
  31. $(call QUIET_INSTALL, Documentation-man)
  32. $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
  33. $(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
  34. uninstall: helpers-uninstall
  35. $(call QUIET_UNINST, Documentation-man)
  36. $(Q)$(RM) $(addprefix $(DESTDIR)$(man8dir)/,$(_DOC_MAN8))
  37. $(Q)$(RMDIR) $(DESTDIR)$(man8dir)
  38. .PHONY: man man8 clean install uninstall
  39. .DEFAULT_GOAL := man