.. | .. |
---|
| 1 | +# SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | include ../../../scripts/Makefile.include |
---|
2 | | -include ../../../scripts/utilities.mak |
---|
3 | 3 | |
---|
4 | 4 | INSTALL ?= install |
---|
5 | 5 | RM ?= rm -f |
---|
.. | .. |
---|
18 | 18 | # Load targets for building eBPF helpers man page. |
---|
19 | 19 | include ../../Makefile.helpers |
---|
20 | 20 | |
---|
21 | | -MAN8_RST = $(filter-out $(HELPERS_RST),$(wildcard *.rst)) |
---|
| 21 | +MAN8_RST = $(wildcard bpftool*.rst) |
---|
22 | 22 | |
---|
23 | 23 | _DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST)) |
---|
24 | 24 | DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8)) |
---|
.. | .. |
---|
27 | 27 | man8: $(DOC_MAN8) |
---|
28 | 28 | |
---|
29 | 29 | 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") |
---|
30 | 41 | |
---|
31 | 42 | $(OUTPUT)%.8: %.rst |
---|
32 | 43 | ifndef RST2MAN_DEP |
---|
33 | 44 | $(error "rst2man not found, but required to generate man pages") |
---|
34 | 45 | endif |
---|
35 | | - $(QUIET_GEN)rst2man $< > $@ |
---|
| 46 | + $(QUIET_GEN)( cat $< ; printf "%b" $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@ |
---|
36 | 47 | |
---|
37 | 48 | clean: helpers-clean |
---|
38 | 49 | $(call QUIET_CLEAN, Documentation) |
---|