All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles
@ 2017-12-07 23:00 Jakub Kicinski
  2017-12-07 23:00 ` [PATCH net-next 1/2] tools: bpftool: harmonise Makefile and Documentation/Makefile Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jakub Kicinski @ 2017-12-07 23:00 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, daniel, alexei.starovoitov, Jakub Kicinski

Hi!

This is a follow up to a series of Makefile fixes for bpftool from
two weeks ago.  I think there will have to be a merge back of net-next
into bpf-next (or rebase), AFAICT the previous series arrived in
net-next already, but not in bpf-next.  I hope that makes sense.
FWIW this should not conflict with Roman's cgroup work.

Quentin says:

First patch of this series cleans up the two Makefiles (Makefile and
Documentation/Makefile) and make their contents more consistent.

The second one add "uninstall" and "doc-uninstall" targets, to remove files
previously installed on the system with "install" and "doc-install"
targets.


Quentin Monnet (2):
  tools: bpftool: harmonise Makefile and Documentation/Makefile
  tools: bpftool: create "uninstall", "doc-uninstall" make targets

 tools/bpf/bpftool/Documentation/Makefile | 30 ++++++++++------
 tools/bpf/bpftool/Makefile               | 61 ++++++++++++++++----------------
 tools/scripts/Makefile.include           |  1 +
 3 files changed, 52 insertions(+), 40 deletions(-)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] tools: bpftool: harmonise Makefile and Documentation/Makefile
  2017-12-07 23:00 [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles Jakub Kicinski
@ 2017-12-07 23:00 ` Jakub Kicinski
  2017-12-07 23:00 ` [PATCH net-next 2/2] tools: bpftool: create "uninstall", "doc-uninstall" make targets Jakub Kicinski
  2017-12-08 19:46 ` [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles Daniel Borkmann
  2 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2017-12-07 23:00 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, daniel, alexei.starovoitov, Quentin Monnet

From: Quentin Monnet <quentin.monnet@netronome.com>

Several minor fixes and harmonisation items for Makefiles:

* Use the same mechanism for verbose/non-verbose output in two files
  ("$(Q)"), for all commands.
* Use calls to "QUIET_INSTALL" and equivalent in Makefile. In
  particular, use "call(descend,…)" instead of "make -C" to run
  documentation targets.
* Add a "doc-clean" target, aligned on "doc" and "doc-install".
* Make "install" target in Makefile depend on "bpftool".
* Remove condition on DESTDIR to initialise prefix in doc Makefile.
* Remove modification of VPATH based on OUTPUT, it is unused.
* Formatting: harmonise spaces around equal signs.
* Make install path for man pages /usr/local/man instead of
  /usr/local/share/man (respects the Makefile conventions, and the
  latter is usually a symbolic link to the former anyway).
* Do not erase prefix if set by user in bpftool Makefile.
* Fix install target for bpftool: append DESTDIR to install path.

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
---
 tools/bpf/bpftool/Documentation/Makefile | 22 +++++++------
 tools/bpf/bpftool/Makefile               | 53 ++++++++++++++------------------
 2 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/tools/bpf/bpftool/Documentation/Makefile b/tools/bpf/bpftool/Documentation/Makefile
index 37292bb5ce60..71c17fab4f2f 100644
--- a/tools/bpf/bpftool/Documentation/Makefile
+++ b/tools/bpf/bpftool/Documentation/Makefile
@@ -4,11 +4,14 @@ include ../../../scripts/utilities.mak
 INSTALL ?= install
 RM ?= rm -f
 
-# Make the path relative to DESTDIR, not prefix
-ifndef DESTDIR
-prefix ?= /usr/local
+ifeq ($(V),1)
+  Q =
+else
+  Q = @
 endif
-mandir ?= $(prefix)/share/man
+
+prefix ?= /usr/local
+mandir ?= $(prefix)/man
 man8dir = $(mandir)/man8
 
 MAN8_RST = $(wildcard *.rst)
@@ -20,15 +23,16 @@ man: man8
 man8: $(DOC_MAN8)
 
 $(OUTPUT)%.8: %.rst
-	rst2man $< > $@
+	$(QUIET_GEN)rst2man $< > $@
 
 clean:
-	$(call QUIET_CLEAN, Documentation) $(RM) $(DOC_MAN8)
+	$(call QUIET_CLEAN, Documentation)
+	$(Q)$(RM) $(DOC_MAN8)
 
 install: man
-	$(call QUIET_INSTALL, Documentation-man) \
-		$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir); \
-		$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir);
+	$(call QUIET_INSTALL, Documentation-man)
+	$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
+	$(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
 
 .PHONY: man man8 clean install
 .DEFAULT_GOAL := man
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index ec3052c0b004..203ae2e14fbc 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -1,25 +1,10 @@
 include ../../scripts/Makefile.include
-
 include ../../scripts/utilities.mak
 
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
-#$(info Determined 'srctree' to be $(srctree))
-endif
-
-ifneq ($(objtree),)
-#$(info Determined 'objtree' to be $(objtree))
-endif
-
-ifneq ($(OUTPUT),)
-#$(info Determined 'OUTPUT' to be $(OUTPUT))
-# Adding $(OUTPUT) as a directory to look for source files,
-# because use generated output files as sources dependency
-# for flex/bison parsers.
-VPATH += $(OUTPUT)
-export VPATH
 endif
 
 ifeq ($(V),1)
@@ -28,12 +13,12 @@ else
   Q = @
 endif
 
-BPF_DIR	= $(srctree)/tools/lib/bpf/
+BPF_DIR = $(srctree)/tools/lib/bpf/
 
 ifneq ($(OUTPUT),)
-  BPF_PATH=$(OUTPUT)
+  BPF_PATH = $(OUTPUT)
 else
-  BPF_PATH=$(BPF_DIR)
+  BPF_PATH = $(BPF_DIR)
 endif
 
 LIBBPF = $(BPF_PATH)libbpf.a
@@ -45,7 +30,7 @@ $(LIBBPF): FORCE
 	$(call QUIET_CLEAN, libbpf)
 	$(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) clean >/dev/null
 
-prefix = /usr/local
+prefix ?= /usr/local
 bash_compdir ?= /usr/share/bash-completion/completions
 
 CC = gcc
@@ -55,12 +40,15 @@ CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow
 CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf -I$(srctree)/kernel/bpf/
 LIBS = -lelf -lbfd -lopcodes $(LIBBPF)
 
+INSTALL ?= install
+RM ?= rm -f
+
 include $(wildcard *.d)
 
 all: $(OUTPUT)bpftool
 
-SRCS=$(wildcard *.c)
-OBJS=$(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o
+SRCS = $(wildcard *.c)
+OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o
 
 $(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
 	$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
@@ -73,21 +61,26 @@ $(OUTPUT)%.o: %.c
 
 clean: $(LIBBPF)-clean
 	$(call QUIET_CLEAN, bpftool)
-	$(Q)rm -rf $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
+	$(Q)$(RM) $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
 
-install:
-	install -m 0755 -d $(prefix)/sbin
-	install $(OUTPUT)bpftool $(prefix)/sbin/bpftool
-	install -m 0755 -d $(bash_compdir)
-	install -m 0644 bash-completion/bpftool $(bash_compdir)
+install: $(OUTPUT)bpftool
+	$(call QUIET_INSTALL, bpftool)
+	$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/sbin
+	$(Q)$(INSTALL) $(OUTPUT)bpftool $(DESTDIR)$(prefix)/sbin/bpftool
+	$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir)
+	$(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir)
 
 doc:
-	$(Q)$(MAKE) -C Documentation/
+	$(call descend,Documentation)
+
+doc-clean:
+	$(call descend,Documentation,clean)
 
 doc-install:
-	$(Q)$(MAKE) -C Documentation/ install
+	$(call descend,Documentation,install)
 
 FORCE:
 
-.PHONY: all clean FORCE install doc doc-install
+.PHONY: all FORCE clean install
+.PHONY: doc doc-clean doc-install
 .DEFAULT_GOAL := all
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] tools: bpftool: create "uninstall", "doc-uninstall" make targets
  2017-12-07 23:00 [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles Jakub Kicinski
  2017-12-07 23:00 ` [PATCH net-next 1/2] tools: bpftool: harmonise Makefile and Documentation/Makefile Jakub Kicinski
@ 2017-12-07 23:00 ` Jakub Kicinski
  2017-12-13 11:16   ` Arnaldo Carvalho de Melo
  2017-12-08 19:46 ` [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles Daniel Borkmann
  2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2017-12-07 23:00 UTC (permalink / raw)
  To: netdev
  Cc: oss-drivers, daniel, alexei.starovoitov, Quentin Monnet,
	Arnaldo Carvalho de Melo, Masahiro Yamada

From: Quentin Monnet <quentin.monnet@netronome.com>

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>
---
For addition to tools/scripts/Makefile.include:

CC: Arnaldo Carvalho de Melo <acme@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>

 tools/bpf/bpftool/Documentation/Makefile |  8 +++++++-
 tools/bpf/bpftool/Makefile               | 12 ++++++++++--
 tools/scripts/Makefile.include           |  1 +
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/tools/bpf/bpftool/Documentation/Makefile b/tools/bpf/bpftool/Documentation/Makefile
index 71c17fab4f2f..c462a928e03d 100644
--- a/tools/bpf/bpftool/Documentation/Makefile
+++ b/tools/bpf/bpftool/Documentation/Makefile
@@ -3,6 +3,7 @@ include ../../../scripts/utilities.mak
 
 INSTALL ?= install
 RM ?= rm -f
+RMDIR ?= rmdir --ignore-fail-on-non-empty
 
 ifeq ($(V),1)
   Q =
@@ -34,5 +35,10 @@ install: man
 	$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
 	$(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
 
-.PHONY: man man8 clean install
+uninstall:
+	$(call QUIET_UNINST, Documentation-man)
+	$(Q)$(RM) $(addprefix $(DESTDIR)$(man8dir)/,$(_DOC_MAN8))
+	$(Q)$(RMDIR) $(DESTDIR)$(man8dir)
+
+.PHONY: man man8 clean install uninstall
 .DEFAULT_GOAL := man
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 203ae2e14fbc..3f17ad317512 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -70,6 +70,11 @@ install: $(OUTPUT)bpftool
 	$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir)
 	$(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir)
 
+uninstall:
+	$(call QUIET_UNINST, bpftool)
+	$(Q)$(RM) $(DESTDIR)$(prefix)/sbin/bpftool
+	$(Q)$(RM) $(DESTDIR)$(bash_compdir)/bpftool
+
 doc:
 	$(call descend,Documentation)
 
@@ -79,8 +84,11 @@ install: $(OUTPUT)bpftool
 doc-install:
 	$(call descend,Documentation,install)
 
+doc-uninstall:
+	$(call descend,Documentation,uninstall)
+
 FORCE:
 
-.PHONY: all FORCE clean install
-.PHONY: doc doc-clean doc-install
+.PHONY: all FORCE clean install uninstall
+.PHONY: doc doc-clean doc-install doc-uninstall
 .DEFAULT_GOAL := all
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 3fab179b1aba..fcb3ed0be5f8 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -99,5 +99,6 @@ ifneq ($(silent),1)
 
 	QUIET_CLEAN    = @printf '  CLEAN    %s\n' $1;
 	QUIET_INSTALL  = @printf '  INSTALL  %s\n' $1;
+	QUIET_UNINST   = @printf '  UNINST   %s\n' $1;
   endif
 endif
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles
  2017-12-07 23:00 [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles Jakub Kicinski
  2017-12-07 23:00 ` [PATCH net-next 1/2] tools: bpftool: harmonise Makefile and Documentation/Makefile Jakub Kicinski
  2017-12-07 23:00 ` [PATCH net-next 2/2] tools: bpftool: create "uninstall", "doc-uninstall" make targets Jakub Kicinski
@ 2017-12-08 19:46 ` Daniel Borkmann
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2017-12-08 19:46 UTC (permalink / raw)
  To: Jakub Kicinski, netdev; +Cc: oss-drivers, alexei.starovoitov

On 12/08/2017 12:00 AM, Jakub Kicinski wrote:
> Hi!
> 
> This is a follow up to a series of Makefile fixes for bpftool from
> two weeks ago.  I think there will have to be a merge back of net-next
> into bpf-next (or rebase), AFAICT the previous series arrived in
> net-next already, but not in bpf-next.  I hope that makes sense.
> FWIW this should not conflict with Roman's cgroup work.
> 
> Quentin says:
> 
> First patch of this series cleans up the two Makefiles (Makefile and
> Documentation/Makefile) and make their contents more consistent.
> 
> The second one add "uninstall" and "doc-uninstall" targets, to remove files
> previously installed on the system with "install" and "doc-install"
> targets.

Series applied to bpf-next, thanks guys!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 2/2] tools: bpftool: create "uninstall", "doc-uninstall" make targets
  2017-12-07 23:00 ` [PATCH net-next 2/2] tools: bpftool: create "uninstall", "doc-uninstall" make targets Jakub Kicinski
@ 2017-12-13 11:16   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-13 11:16 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, oss-drivers, daniel, alexei.starovoitov, acme,
	Quentin Monnet, Masahiro Yamada

Em Thu, Dec 07, 2017 at 03:00:18PM -0800, Jakub Kicinski escreveu:
> From: Quentin Monnet <quentin.monnet@netronome.com>
> 
> 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>


Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

> ---
> For addition to tools/scripts/Makefile.include:
> 
> CC: Arnaldo Carvalho de Melo <acme@redhat.com>
> CC: Masahiro Yamada <yamada.masahiro@socionext.com>
> 
>  tools/bpf/bpftool/Documentation/Makefile |  8 +++++++-
>  tools/bpf/bpftool/Makefile               | 12 ++++++++++--
>  tools/scripts/Makefile.include           |  1 +
>  3 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/bpf/bpftool/Documentation/Makefile b/tools/bpf/bpftool/Documentation/Makefile
> index 71c17fab4f2f..c462a928e03d 100644
> --- a/tools/bpf/bpftool/Documentation/Makefile
> +++ b/tools/bpf/bpftool/Documentation/Makefile
> @@ -3,6 +3,7 @@ include ../../../scripts/utilities.mak
>  
>  INSTALL ?= install
>  RM ?= rm -f
> +RMDIR ?= rmdir --ignore-fail-on-non-empty
>  
>  ifeq ($(V),1)
>    Q =
> @@ -34,5 +35,10 @@ install: man
>  	$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
>  	$(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
>  
> -.PHONY: man man8 clean install
> +uninstall:
> +	$(call QUIET_UNINST, Documentation-man)
> +	$(Q)$(RM) $(addprefix $(DESTDIR)$(man8dir)/,$(_DOC_MAN8))
> +	$(Q)$(RMDIR) $(DESTDIR)$(man8dir)
> +
> +.PHONY: man man8 clean install uninstall
>  .DEFAULT_GOAL := man
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index 203ae2e14fbc..3f17ad317512 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -70,6 +70,11 @@ install: $(OUTPUT)bpftool
>  	$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir)
>  	$(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir)
>  
> +uninstall:
> +	$(call QUIET_UNINST, bpftool)
> +	$(Q)$(RM) $(DESTDIR)$(prefix)/sbin/bpftool
> +	$(Q)$(RM) $(DESTDIR)$(bash_compdir)/bpftool
> +
>  doc:
>  	$(call descend,Documentation)
>  
> @@ -79,8 +84,11 @@ install: $(OUTPUT)bpftool
>  doc-install:
>  	$(call descend,Documentation,install)
>  
> +doc-uninstall:
> +	$(call descend,Documentation,uninstall)
> +
>  FORCE:
>  
> -.PHONY: all FORCE clean install
> -.PHONY: doc doc-clean doc-install
> +.PHONY: all FORCE clean install uninstall
> +.PHONY: doc doc-clean doc-install doc-uninstall
>  .DEFAULT_GOAL := all
> diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
> index 3fab179b1aba..fcb3ed0be5f8 100644
> --- a/tools/scripts/Makefile.include
> +++ b/tools/scripts/Makefile.include
> @@ -99,5 +99,6 @@ ifneq ($(silent),1)
>  
>  	QUIET_CLEAN    = @printf '  CLEAN    %s\n' $1;
>  	QUIET_INSTALL  = @printf '  INSTALL  %s\n' $1;
> +	QUIET_UNINST   = @printf '  UNINST   %s\n' $1;
>    endif
>  endif
> -- 
> 2.15.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-13 11:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 23:00 [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles Jakub Kicinski
2017-12-07 23:00 ` [PATCH net-next 1/2] tools: bpftool: harmonise Makefile and Documentation/Makefile Jakub Kicinski
2017-12-07 23:00 ` [PATCH net-next 2/2] tools: bpftool: create "uninstall", "doc-uninstall" make targets Jakub Kicinski
2017-12-13 11:16   ` Arnaldo Carvalho de Melo
2017-12-08 19:46 ` [PATCH net-next 0/2] tools: bpftool: clean up and extend Makefiles Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.