perf cpumap: Add new struct for cpu aggregation
[linux-2.6-microblaze.git] / tools / bpf / Makefile.helpers
1 # SPDX-License-Identifier: GPL-2.0-only
2 ifndef allow-override
3   include ../scripts/Makefile.include
4   include ../scripts/utilities.mak
5 else
6   # Assume Makefile.helpers is being run from bpftool/Documentation
7   # subdirectory. Go up two more directories to fetch bpf.h header and
8   # associated script.
9   UP2DIR := ../../
10 endif
11
12 INSTALL ?= install
13 RM ?= rm -f
14 RMDIR ?= rmdir --ignore-fail-on-non-empty
15
16 ifeq ($(V),1)
17   Q =
18 else
19   Q = @
20 endif
21
22 prefix ?= /usr/local
23 mandir ?= $(prefix)/man
24 man7dir = $(mandir)/man7
25
26 HELPERS_RST = bpf-helpers.rst
27 MAN7_RST = $(HELPERS_RST)
28
29 _DOC_MAN7 = $(patsubst %.rst,%.7,$(MAN7_RST))
30 DOC_MAN7 = $(addprefix $(OUTPUT),$(_DOC_MAN7))
31
32 helpers: man7
33 man7: $(DOC_MAN7)
34
35 RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
36
37 $(OUTPUT)$(HELPERS_RST): $(UP2DIR)../../include/uapi/linux/bpf.h
38         $(QUIET_GEN)$(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@
39
40 $(OUTPUT)%.7: $(OUTPUT)%.rst
41 ifndef RST2MAN_DEP
42         $(error "rst2man not found, but required to generate man pages")
43 endif
44         $(QUIET_GEN)rst2man $< > $@
45
46 helpers-clean:
47         $(call QUIET_CLEAN, eBPF_helpers-manpage)
48         $(Q)$(RM) $(DOC_MAN7) $(OUTPUT)$(HELPERS_RST)
49
50 helpers-install: helpers
51         $(call QUIET_INSTALL, eBPF_helpers-manpage)
52         $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
53         $(Q)$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
54
55 helpers-uninstall:
56         $(call QUIET_UNINST, eBPF_helpers-manpage)
57         $(Q)$(RM) $(addprefix $(DESTDIR)$(man7dir)/,$(_DOC_MAN7))
58         $(Q)$(RMDIR) $(DESTDIR)$(man7dir)
59
60 .PHONY: helpers helpers-clean helpers-install helpers-uninstall