hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/tools/bpf/bpftool/Documentation/Makefile
....@@ -1,5 +1,5 @@
1
+# SPDX-License-Identifier: GPL-2.0-only
12 include ../../../scripts/Makefile.include
2
-include ../../../scripts/utilities.mak
33
44 INSTALL ?= install
55 RM ?= rm -f
....@@ -18,7 +18,7 @@
1818 # Load targets for building eBPF helpers man page.
1919 include ../../Makefile.helpers
2020
21
-MAN8_RST = $(filter-out $(HELPERS_RST),$(wildcard *.rst))
21
+MAN8_RST = $(wildcard bpftool*.rst)
2222
2323 _DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST))
2424 DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
....@@ -27,12 +27,23 @@
2727 man8: $(DOC_MAN8)
2828
2929 RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
30
+RST2MAN_OPTS += --verbose
31
+
32
+list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
33
+see_also = $(subst " ",, \
34
+ "\n" \
35
+ "SEE ALSO\n" \
36
+ "========\n" \
37
+ "\t**bpf**\ (2),\n" \
38
+ "\t**bpf-helpers**\\ (7)" \
39
+ $(foreach page,$(call list_pages,$(1)),",\n\t**$(page)**\\ (8)") \
40
+ "\n")
3041
3142 $(OUTPUT)%.8: %.rst
3243 ifndef RST2MAN_DEP
3344 $(error "rst2man not found, but required to generate man pages")
3445 endif
35
- $(QUIET_GEN)rst2man $< > $@
46
+ $(QUIET_GEN)( cat $< ; printf "%b" $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
3647
3748 clean: helpers-clean
3849 $(call QUIET_CLEAN, Documentation)