...
Listing each target is going to be a PITA to maintain. It would be
better to put targets into a build directory (bin?) and ignore the
directory.
It would require a lot of modifications to the Makefile and more
complexity. It seems much more simple for everyone to stick to a simple
gitignore file easily maintainable:
$ awk '$1 == "hostprogs-y" { print $3 }' < Makefile > .gitignore
Alexei, Daniel, what do you think about this? Do you want me to send a
v2 with the new tests?
Mickaël
...
Listing each target is going to be a PITA to maintain. It would be
better to put targets into a build directory (bin?) and ignore the
directory.
It would require a lot of modifications to the Makefile and more
complexity. It seems much more simple for everyone to stick to a simple
gitignore file easily maintainable:
$ awk '$1 == "hostprogs-y" { print $3 }' < Makefile > .gitignore
Alexei, Daniel, what do you think about this? Do you want me to send a
v2 with the new tests?
The problem stems from the fact that bpf samples do not really fall into
the 'hostprogs' category (see "4 Host Program support" in
Documentation/kbuild/makefiles.txt). Fixing samples/bpf to not rely on
it is the better long term solution. Building of tools/ for example does
not rely on it so there is an existing example of leveraging kernel
headers without the overhead.
From: Alexander Alemayhu <hidden> Date: 2017-05-17 08:18:55
On Tue, May 16, 2017 at 04:27:36PM -0700, David Ahern wrote:
The problem stems from the fact that bpf samples do not really fall into
the 'hostprogs' category (see "4 Host Program support" in
Documentation/kbuild/makefiles.txt). Fixing samples/bpf to not rely on
it is the better long term solution. Building of tools/ for example does
not rely on it so there is an existing example of leveraging kernel
headers without the overhead.
+1
I have looked into this but found it to be not easy and all attempts to
change the Makefile has resulted in obscure errors :/
Getting clang to output in a different directory was easy[0], but I guess
this is not the right approach either. Have you tried making the change?
[0]:
@@ -1,6 +1,13 @@# kbuild trick to avoid linker error. Can be omitted if a module is built.obj-:=dummy.o+ifndef O+OUTPUT:=$(shellpwd)/samples/bpf/_build/+else+OUTPUT:=$O/+endif+$(shellmkdir-p$(OUTPUT))+# List of programs to buildhostprogs-y:=test_lru_disthostprogs-y+=sock_example
From: David Ahern <hidden> Date: 2017-05-18 20:03:39
On 5/17/17 1:18 AM, Alexander Alemayhu wrote:
I have looked into this but found it to be not easy and all attempts to
change the Makefile has resulted in obscure errors :/
Getting clang to output in a different directory was easy[0], but I guess
this is not the right approach either. Have you tried making the change?
spent an hour so a few weeks back. It is not trivial, but someone needs
to find to fix it now.
perf is the example to use: you can build it from both top level kernel
directory (e.g, make -C tools/perf O=/tmp/perf) and the perf directory
(cd tools/perf; make O=/tmp/perf). Both are wanted for samples/bpf and
it would be nice to keep the O= option as well.
I don't have the time for the next few weeks. Perhaps mid-June I can
take a look.