Skip to content

Commit

Permalink
libbpf-tools: Allow to install apps with prefixed names
Browse files Browse the repository at this point in the history
Fedora adds prefix bpf- to the tool names, mainly to distinguish them
from the old tools written in Python. Alpine Linux is going to do the
same, but for a slightly different reason - there are dozens of these
tools, so it's a good idea to add them a common prefix, to make it easier
to recognize them among all other commands.

See-Also: iovisor#3263

See-Also: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/35688
  • Loading branch information
jirutka authored and chenhengqi committed Dec 20, 2023
1 parent 2ac4a63 commit 3469bf1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libbpf-tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CFLAGS := -g -O2 -Wall
BPFCFLAGS := -g -O2 -Wall
INSTALL ?= install
prefix ?= /usr/local
bindir := $(prefix)/bin
ARCH ?= $(shell uname -m | sed 's/x86_64/x86/' | sed 's/aarch64/arm64/' \
| sed 's/ppc64le/powerpc/' | sed 's/mips.*/mips/' \
| sed 's/riscv64/riscv/' | sed 's/loongarch.*/loongarch/' \
Expand Down Expand Up @@ -222,21 +223,21 @@ $(LIBBPF_OBJ): $(wildcard $(LIBBPF_SRC)/*.[ch]) | $(OUTPUT)/libbpf

$(FSSLOWER_ALIASES): fsslower
$(call msg,SYMLINK,$@)
$(Q)ln -f -s $^ $@
$(Q)ln -f -s $(APP_PREFIX)$^ $@

$(FSDIST_ALIASES): fsdist
$(call msg,SYMLINK,$@)
$(Q)ln -f -s $^ $@
$(Q)ln -f -s $(APP_PREFIX)$^ $@

$(SIGSNOOP_ALIAS): sigsnoop
$(call msg,SYMLINK,$@)
$(Q)ln -f -s $^ $@
$(Q)ln -f -s $(APP_PREFIX)$^ $@

install: $(APPS) $(APP_ALIASES)
$(call msg, INSTALL libbpf-tools)
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin
$(Q)$(INSTALL) $(APPS) $(DESTDIR)$(prefix)/bin
$(Q)cp -a $(APP_ALIASES) $(DESTDIR)$(prefix)/bin
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
$(Q)$(foreach app,$(APPS),$(INSTALL) $(app) $(DESTDIR)$(bindir)/$(APP_PREFIX)$(app);)
$(Q)$(foreach alias,$(APP_ALIASES),cp -a $(alias) $(DESTDIR)$(bindir)/$(APP_PREFIX)$(alias);)

.PHONY: force
force:
Expand Down

0 comments on commit 3469bf1

Please sign in to comment.