Add install target to libbpf-tools
authorJiri Olsa <jolsa@kernel.org>
Fri, 5 Feb 2021 20:55:55 +0000 (21:55 +0100)
committeryonghong-song <ys114321@gmail.com>
Sat, 6 Feb 2021 20:53:07 +0000 (12:53 -0800)
We plan to put those tools in separate rpm,
so we need a way to install them.

Adding install target with standard DESTDIR
and prefix make variables.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
libbpf-tools/Makefile

index dc139570655357e65a44bc8ed945f5f73e67fbaf..77b2b8c284800651d18cde1d3dc89639699d0377 100644 (file)
@@ -8,6 +8,8 @@ LIBBPF_OBJ := $(abspath $(OUTPUT)/libbpf.a)
 INCLUDES := -I$(OUTPUT)
 CFLAGS := -g -O2 -Wall
 ARCH := $(shell uname -m | sed 's/x86_64/x86/')
+INSTALL ?= install
+prefix ?= /usr/local
 
 APPS = \
        biolatency \
@@ -92,6 +94,11 @@ $(LIBBPF_OBJ): $(wildcard $(LIBBPF_SRC)/*.[ch]) | $(OUTPUT)/libbpf
                    INCLUDEDIR= LIBDIR= UAPIDIR=                              \
                    install
 
+install: $(APPS)
+       $(call msg, INSTALL libbpf-tools)
+       $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin
+       $(Q)$(INSTALL) $(APPS) $(DESTDIR)$(prefix)/bin
+
 # delete failed targets
 .DELETE_ON_ERROR:
 # keep intermediate (.skel.h, .bpf.o, etc) targets