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