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