summaryrefslogtreecommitdiffstats
path: root/tools/bpf/Makefile
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2018-03-08 23:00:37 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2018-03-09 10:22:59 +0100
commitfde68c5becb552ce96fcf1d123624b5c11baa187 (patch)
treec828c3f12ea8899c51b342a23960477dc080d8b1 /tools/bpf/Makefile
parent5a8997f207154826c7bf1a97acf75ffb44159c50 (diff)
downloadlinux-fde68c5becb552ce96fcf1d123624b5c11baa187.tar.bz2
tools: bpf: consistent make bpf_install
Currently, make bpf_install in tools/ does not respect DESTDIR. Moreover, it installs to /usr/bin/ unconditionally. Let it respect DESTDIR and allow prefix to be specified. Also, to be more consistent with bpftool and with the usual customs, default the prefix to /usr/local instead of /usr. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/bpf/Makefile')
-rw-r--r--tools/bpf/Makefile10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index e7b15967492e..c42ca24a072d 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -1,12 +1,13 @@
# SPDX-License-Identifier: GPL-2.0
include ../scripts/Makefile.include
-prefix = /usr
+prefix ?= /usr/local
CC = gcc
LEX = flex
YACC = bison
MAKE = make
+INSTALL ?= install
CFLAGS += -Wall -O2
CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include
@@ -67,9 +68,10 @@ clean: bpftool_clean
$(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
install: bpftool_install
- install $(OUTPUT)bpf_jit_disasm $(prefix)/bin/bpf_jit_disasm
- install $(OUTPUT)bpf_dbg $(prefix)/bin/bpf_dbg
- install $(OUTPUT)bpf_asm $(prefix)/bin/bpf_asm
+ $(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin
+ $(INSTALL) $(OUTPUT)bpf_jit_disasm $(DESTDIR)$(prefix)/bin/bpf_jit_disasm
+ $(INSTALL) $(OUTPUT)bpf_dbg $(DESTDIR)$(prefix)/bin/bpf_dbg
+ $(INSTALL) $(OUTPUT)bpf_asm $(DESTDIR)$(prefix)/bin/bpf_asm
bpftool:
$(MAKE) -C bpftool