bpftool: Add install-bin target to install binary only
authorQuentin Monnet <quentin@isovalent.com>
Thu, 7 Oct 2021 19:44:38 +0000 (20:44 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 8 Oct 2021 19:02:40 +0000 (12:02 -0700)
With "make install", bpftool installs its binary and its bash completion
file. Usually, this is what we want. But a few components in the kernel
repository (namely, BPF iterators and selftests) also install bpftool
locally before using it. In such a case, bash completion is not
necessary and is just a useless build artifact.

Let's add an "install-bin" target to bpftool, to offer a way to install
the binary only.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211007194438.34443-13-quentin@isovalent.com
kernel/bpf/preload/iterators/Makefile
tools/bpf/bpftool/Makefile
tools/testing/selftests/bpf/Makefile

index a4aedc7..b8bd605 100644 (file)
@@ -66,4 +66,4 @@ $(DEFAULT_BPFTOOL): $(BPFOBJ) | $(BPFTOOL_OUTPUT)
                    OUTPUT=$(BPFTOOL_OUTPUT)/                                  \
                    LIBBPF_OUTPUT=$(LIBBPF_OUTPUT)/                            \
                    LIBBPF_DESTDIR=$(LIBBPF_DESTDIR)/                          \
-                   prefix= DESTDIR=$(abs_out)/ install
+                   prefix= DESTDIR=$(abs_out)/ install-bin
index ba02d71..9c2d13c 100644 (file)
@@ -226,10 +226,12 @@ clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean feature-detect-clean
        $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpftool
        $(Q)$(RM) -r -- $(OUTPUT)feature/
 
-install: $(OUTPUT)bpftool
+install-bin: $(OUTPUT)bpftool
        $(call QUIET_INSTALL, bpftool)
        $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/sbin
        $(Q)$(INSTALL) $(OUTPUT)bpftool $(DESTDIR)$(prefix)/sbin/bpftool
+
+install: install-bin
        $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir)
        $(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir)
 
@@ -256,6 +258,6 @@ zdep:
        @if [ "$(feature-zlib)" != "1" ]; then echo "No zlib found"; exit 1 ; fi
 
 .SECONDARY:
-.PHONY: all FORCE clean install uninstall zdep
+.PHONY: all FORCE clean install-bin install uninstall zdep
 .PHONY: doc doc-clean doc-install doc-uninstall
 .DEFAULT_GOAL := all
index e023d73..4982225 100644 (file)
@@ -216,7 +216,7 @@ $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
                    OUTPUT=$(HOST_BUILD_DIR)/bpftool/                          \
                    LIBBPF_OUTPUT=$(HOST_BUILD_DIR)/libbpf/                    \
                    LIBBPF_DESTDIR=$(HOST_SCRATCH_DIR)/                        \
-                   prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install
+                   prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install-bin
 
 all: docs