Skip to content

Commit fde68c5

Browse files
Jiri Bencborkmann
authored andcommitted
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 <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 5a8997f commit fde68c5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/bpf/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# SPDX-License-Identifier: GPL-2.0
22
include ../scripts/Makefile.include
33

4-
prefix = /usr
4+
prefix ?= /usr/local
55

66
CC = gcc
77
LEX = flex
88
YACC = bison
99
MAKE = make
10+
INSTALL ?= install
1011

1112
CFLAGS += -Wall -O2
1213
CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include
@@ -67,9 +68,10 @@ clean: bpftool_clean
6768
$(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
6869

6970
install: bpftool_install
70-
install $(OUTPUT)bpf_jit_disasm $(prefix)/bin/bpf_jit_disasm
71-
install $(OUTPUT)bpf_dbg $(prefix)/bin/bpf_dbg
72-
install $(OUTPUT)bpf_asm $(prefix)/bin/bpf_asm
71+
$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin
72+
$(INSTALL) $(OUTPUT)bpf_jit_disasm $(DESTDIR)$(prefix)/bin/bpf_jit_disasm
73+
$(INSTALL) $(OUTPUT)bpf_dbg $(DESTDIR)$(prefix)/bin/bpf_dbg
74+
$(INSTALL) $(OUTPUT)bpf_asm $(DESTDIR)$(prefix)/bin/bpf_asm
7375

7476
bpftool:
7577
$(MAKE) -C bpftool

0 commit comments

Comments
 (0)