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