* [PATCH net-next] bpf: install libbpf headers on 'make install'
@ 2017-07-24 21:22 Jakub Kicinski
2017-07-25 16:51 ` Daniel Borkmann
2017-07-25 18:17 ` [PATCH net-next v2] " Jakub Kicinski
0 siblings, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2017-07-24 21:22 UTC (permalink / raw)
To: netdev; +Cc: daniel, alexei.starovoitov, oss-drivers, Jakub Kicinski
Install the bpf.h header to $(prefix)/include/bpf/ directory.
This is necessary to build standalone applications using libbpf,
without the need to clone the kernel sources and point to them.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
I'm not 100% sure if it's OK to export the header file and which
directory it should end up in (bpf/? libbpf/?).
tools/lib/bpf/Makefile | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 1f5300e56b44..22dad416e0bd 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -46,6 +46,7 @@ else
endif
prefix ?= /usr/local
+headerdir = $(prefix)/include/bpf/
libdir = $(prefix)/$(libdir_relative)
man_dir = $(prefix)/share/man
man_dir_SQ = '$(subst ','\'',$(man_dir))'
@@ -90,11 +91,13 @@ endif
export prefix libdir src obj
# Shell quotes
+headerdir_SQ = $(subst ','\'',$(headerdir))
libdir_SQ = $(subst ','\'',$(libdir))
libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
LIB_FILE = libbpf.a libbpf.so
+HEADER_FILE = bpf.h
VERSION = $(BPF_VERSION)
PATCHLEVEL = $(BPF_PATCHLEVEL)
@@ -189,7 +192,11 @@ install_lib: all_cmd
$(call QUIET_INSTALL, $(LIB_FILE)) \
$(call do_install,$(LIB_FILE),$(libdir_SQ))
-install: install_lib
+install_hdr: all_cmd
+ $(call QUIET_INSTALL, $(HEADER_FILE)) \
+ $(call do_install,$(HEADER_FILE),$(headerdir_SQ))
+
+install: install_lib install_hdr
### Cleaning rules
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] bpf: install libbpf headers on 'make install'
2017-07-24 21:22 [PATCH net-next] bpf: install libbpf headers on 'make install' Jakub Kicinski
@ 2017-07-25 16:51 ` Daniel Borkmann
2017-07-25 18:17 ` [PATCH net-next v2] " Jakub Kicinski
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2017-07-25 16:51 UTC (permalink / raw)
To: Jakub Kicinski, netdev; +Cc: alexei.starovoitov, oss-drivers
On 07/24/2017 11:22 PM, Jakub Kicinski wrote:
> Install the bpf.h header to $(prefix)/include/bpf/ directory.
> This is necessary to build standalone applications using libbpf,
> without the need to clone the kernel sources and point to them.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> ---
> I'm not 100% sure if it's OK to export the header file and which
> directory it should end up in (bpf/? libbpf/?).
Given the Makefile is heavily derived from tools/lib/traceevent/,
we should probably have a similar install_headers target instead,
in order to keep semantics similar. /include/bpf/ should be good.
> tools/lib/bpf/Makefile | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 1f5300e56b44..22dad416e0bd 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -46,6 +46,7 @@ else
> endif
>
> prefix ?= /usr/local
> +headerdir = $(prefix)/include/bpf/
> libdir = $(prefix)/$(libdir_relative)
> man_dir = $(prefix)/share/man
> man_dir_SQ = '$(subst ','\'',$(man_dir))'
> @@ -90,11 +91,13 @@ endif
> export prefix libdir src obj
>
> # Shell quotes
> +headerdir_SQ = $(subst ','\'',$(headerdir))
> libdir_SQ = $(subst ','\'',$(libdir))
> libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
>
> LIB_FILE = libbpf.a libbpf.so
> +HEADER_FILE = bpf.h
>
> VERSION = $(BPF_VERSION)
> PATCHLEVEL = $(BPF_PATCHLEVEL)
> @@ -189,7 +192,11 @@ install_lib: all_cmd
> $(call QUIET_INSTALL, $(LIB_FILE)) \
> $(call do_install,$(LIB_FILE),$(libdir_SQ))
>
> -install: install_lib
> +install_hdr: all_cmd
> + $(call QUIET_INSTALL, $(HEADER_FILE)) \
> + $(call do_install,$(HEADER_FILE),$(headerdir_SQ))
> +
> +install: install_lib install_hdr
>
> ### Cleaning rules
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2] bpf: install libbpf headers on 'make install'
2017-07-24 21:22 [PATCH net-next] bpf: install libbpf headers on 'make install' Jakub Kicinski
2017-07-25 16:51 ` Daniel Borkmann
@ 2017-07-25 18:17 ` Jakub Kicinski
2017-07-25 19:45 ` Daniel Borkmann
2017-07-26 20:43 ` David Miller
1 sibling, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2017-07-25 18:17 UTC (permalink / raw)
To: netdev, daniel; +Cc: oss-drivers, alexei.starovoitov, Jakub Kicinski
Add a new target to install the bpf.h header to $(prefix)/include/bpf/
directory. This is necessary to build standalone applications using
libbpf, without the need to clone the kernel sources and point to them.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
v2:
- make the header installation similar to tools/lib/traceevent (Daniel).
The functional change is that the header will not be installed as part
of make install, one has to make install_headers, which seems OK.
Out of curiosity - why are only "force elfdep bpfdep" added to the PHONY
target? Is there some Makefile magic that makes adding install* targets
there unnecessary? Or does the PHONY target just not matter in practice
so it's not updated?
tools/lib/bpf/Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 1f5300e56b44..445289555487 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -189,6 +189,10 @@ install_lib: all_cmd
$(call QUIET_INSTALL, $(LIB_FILE)) \
$(call do_install,$(LIB_FILE),$(libdir_SQ))
+install_headers:
+ $(call QUIET_INSTALL, headers) \
+ $(call do_install,bpf.h,$(prefix)/include/bpf,644)
+
install: install_lib
### Cleaning rules
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] bpf: install libbpf headers on 'make install'
2017-07-25 18:17 ` [PATCH net-next v2] " Jakub Kicinski
@ 2017-07-25 19:45 ` Daniel Borkmann
2017-07-26 20:43 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2017-07-25 19:45 UTC (permalink / raw)
To: Jakub Kicinski, netdev; +Cc: oss-drivers, alexei.starovoitov, acme
On 07/25/2017 08:17 PM, Jakub Kicinski wrote:
> Add a new target to install the bpf.h header to $(prefix)/include/bpf/
> directory. This is necessary to build standalone applications using
> libbpf, without the need to clone the kernel sources and point to them.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Looks good to me, we might do the same for libbpf.h later on as
well, though the naming scheme is a confusing choice (bpf.h and
libbpf.h).
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
> ---
> v2:
> - make the header installation similar to tools/lib/traceevent (Daniel).
>
> The functional change is that the header will not be installed as part
> of make install, one has to make install_headers, which seems OK.
>
> Out of curiosity - why are only "force elfdep bpfdep" added to the PHONY
> target? Is there some Makefile magic that makes adding install* targets
> there unnecessary? Or does the PHONY target just not matter in practice
> so it's not updated?
Arnaldo might know better.
> tools/lib/bpf/Makefile | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 1f5300e56b44..445289555487 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -189,6 +189,10 @@ install_lib: all_cmd
> $(call QUIET_INSTALL, $(LIB_FILE)) \
> $(call do_install,$(LIB_FILE),$(libdir_SQ))
>
> +install_headers:
> + $(call QUIET_INSTALL, headers) \
> + $(call do_install,bpf.h,$(prefix)/include/bpf,644)
> +
> install: install_lib
>
> ### Cleaning rules
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] bpf: install libbpf headers on 'make install'
2017-07-25 18:17 ` [PATCH net-next v2] " Jakub Kicinski
2017-07-25 19:45 ` Daniel Borkmann
@ 2017-07-26 20:43 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2017-07-26 20:43 UTC (permalink / raw)
To: jakub.kicinski; +Cc: netdev, daniel, oss-drivers, alexei.starovoitov
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Tue, 25 Jul 2017 11:17:11 -0700
> Add a new target to install the bpf.h header to $(prefix)/include/bpf/
> directory. This is necessary to build standalone applications using
> libbpf, without the need to clone the kernel sources and point to them.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-26 20:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 21:22 [PATCH net-next] bpf: install libbpf headers on 'make install' Jakub Kicinski
2017-07-25 16:51 ` Daniel Borkmann
2017-07-25 18:17 ` [PATCH net-next v2] " Jakub Kicinski
2017-07-25 19:45 ` Daniel Borkmann
2017-07-26 20:43 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).