Skip to content

Commit d324424

Browse files
qmonnetborkmann
authored andcommitted
tools: bpftool: create "uninstall", "doc-uninstall" make targets
Create two targets to remove executable and documentation that would have been previously installed with `make install` and `make doc-install`. Also create a "QUIET_UNINST" helper in tools/scripts/Makefile.include. Do not attempt to remove directories /usr/local/sbin and /usr/share/bash-completions/completions, even if they are empty, as those specific directories probably already existed on the system before we installed the program, and we do not wish to break other makefiles that might assume their existence. Do remvoe /usr/local/share/man/man8 if empty however, as this directory does not seem to exist by default. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 658e85a commit d324424

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎tools/bpf/bpftool/Documentation/Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include ../../../scripts/utilities.mak
33

44
INSTALL ?= install
55
RM ?= rm -f
6+
RMDIR ?= rmdir --ignore-fail-on-non-empty
67

78
ifeq ($(V),1)
89
Q =
@@ -34,5 +35,10 @@ install: man
3435
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
3536
$(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
3637

37-
.PHONY: man man8 clean install
38+
uninstall:
39+
$(call QUIET_UNINST, Documentation-man)
40+
$(Q)$(RM) $(addprefix $(DESTDIR)$(man8dir)/,$(_DOC_MAN8))
41+
$(Q)$(RMDIR) $(DESTDIR)$(man8dir)
42+
43+
.PHONY: man man8 clean install uninstall
3844
.DEFAULT_GOAL := man

‎tools/bpf/bpftool/Makefile‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ install: $(OUTPUT)bpftool
7070
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir)
7171
$(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir)
7272

73+
uninstall:
74+
$(call QUIET_UNINST, bpftool)
75+
$(Q)$(RM) $(DESTDIR)$(prefix)/sbin/bpftool
76+
$(Q)$(RM) $(DESTDIR)$(bash_compdir)/bpftool
77+
7378
doc:
7479
$(call descend,Documentation)
7580

@@ -79,8 +84,11 @@ doc-clean:
7984
doc-install:
8085
$(call descend,Documentation,install)
8186

87+
doc-uninstall:
88+
$(call descend,Documentation,uninstall)
89+
8290
FORCE:
8391

84-
.PHONY: all FORCE clean install
85-
.PHONY: doc doc-clean doc-install
92+
.PHONY: all FORCE clean install uninstall
93+
.PHONY: doc doc-clean doc-install doc-uninstall
8694
.DEFAULT_GOAL := all

‎tools/scripts/Makefile.include‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@ ifneq ($(silent),1)
9999

100100
QUIET_CLEAN = @printf ' CLEAN %s\n' $1;
101101
QUIET_INSTALL = @printf ' INSTALL %s\n' $1;
102+
QUIET_UNINST = @printf ' UNINST %s\n' $1;
102103
endif
103104
endif

0 commit comments

Comments
 (0)