netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Alemayhu <alexander@alemayhu.com>
To: David Ahern <dsahern@gmail.com>
Cc: "Mickaël Salaün" <mic@digikod.net>,
	"David Ahern" <dsa@cumulusnetworks.com>,
	"Alexei Starovoitov" <ast@fb.com>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	linux-kernel@vger.kernel.org,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Wang Nan" <wangnan0@huawei.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries
Date: Wed, 17 May 2017 10:18:44 +0200	[thread overview]
Message-ID: <20170517081844.GA4447@gmail.com> (raw)
In-Reply-To: <ad02fd5c-6812-8f1b-b348-b2ec81b9524b@gmail.com>

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]:
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 6c7468eb3684..79268d310ba5 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -1,6 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
+ifndef O
+  OUTPUT := $(shell pwd)/samples/bpf/_build/
+else
+  OUTPUT := $O/
+endif
+$(shell mkdir -p $(OUTPUT))
+
 # List of programs to build
 hostprogs-y := test_lru_dist
 hostprogs-y += sock_example
@@ -190,4 +197,4 @@ $(obj)/%.o: $(src)/%.c
 		-Wno-gnu-variable-sized-type-not-at-end \
 		-Wno-address-of-packed-member -Wno-tautological-compare \
 		-Wno-unknown-warning-option \
-		-O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@
+		-O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $(OUTPUT)$(shell basename $@)

-- 
Mit freundlichen Grüßen

Alexander Alemayhu

  reply	other threads:[~2017-05-17  8:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-12 21:23 [PATCH v1] samples/bpf: Add a .gitignore for binaries Mickaël Salaün
2017-02-13  1:43 ` David Ahern
2017-05-13 10:30   ` Mickaël Salaün
2017-05-16 23:27     ` David Ahern
2017-05-17  8:18       ` Alexander Alemayhu [this message]
2017-05-18 20:03         ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170517081844.GA4447@gmail.com \
    --to=alexander@alemayhu.com \
    --cc=acme@redhat.com \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=netdev@vger.kernel.org \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).