All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>,
	Martin Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andriin@fb.com>,
	john fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>
Subject: Re: [PATCH bpf-next v3 2/7] tools/bpftool: Force clean of out-of-tree build
Date: Wed, 11 Nov 2020 10:22:41 -0800	[thread overview]
Message-ID: <CAEf4BzZqiFeLVYq-X7Z7cypRYSgLFw3dr=-EEoyzWaDJVFfzug@mail.gmail.com> (raw)
In-Reply-To: <20201111085445.GB2604446@myrica>

On Wed, Nov 11, 2020 at 12:55 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> On Tue, Nov 10, 2020 at 08:57:51PM -0800, Andrii Nakryiko wrote:
> > On Tue, Nov 10, 2020 at 8:46 AM Jean-Philippe Brucker
> > <jean-philippe@linaro.org> wrote:
> > >
> > > Cleaning a partial build can fail if the output directory for libbpf
> > > wasn't created:
> > >
> > > $ make -C tools/bpf/bpftool O=/tmp/bpf clean
> > > /bin/sh: line 0: cd: /tmp/bpf/libbpf/: No such file or directory
> > > tools/scripts/Makefile.include:17: *** output directory "/tmp/bpf/libbpf/" does not exist.  Stop.
> > > make: *** [Makefile:36: /tmp/bpf/libbpf/libbpf.a-clean] Error 2
> > >
> > > As a result make never gets around to clearing the leftover objects. Add
> > > the libbpf output directory as clean dependency to ensure clean always
> > > succeeds (similarly to the "descend" macro). The directory is later
> > > removed by the clean recipe.
> > >
> > > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> > > ---
> > >  tools/bpf/bpftool/Makefile | 8 +++++---
> > >  1 file changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> > > index f60e6ad3a1df..1358c093b812 100644
> > > --- a/tools/bpf/bpftool/Makefile
> > > +++ b/tools/bpf/bpftool/Makefile
> > > @@ -27,11 +27,13 @@ LIBBPF = $(LIBBPF_PATH)libbpf.a
> > >
> > >  BPFTOOL_VERSION ?= $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
> > >
> > > -$(LIBBPF): FORCE
> > > -       $(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))
> > > +$(LIBBPF_OUTPUT):
> > > +       $(QUIET_MKDIR)mkdir -p $@
> > > +
> > > +$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
> > >         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) $(LIBBPF_OUTPUT)libbpf.a
> > >
> > > -$(LIBBPF)-clean:
> > > +$(LIBBPF)-clean: $(LIBBPF_OUTPUT)
> >
> > shouldn't this be `| $(LIBBPF_OUTPUT)` ?
>
> It wouldn't have any effect here. Order-only prerequisites tell make to
> only build the prerequisite before the target, but not to update the
> target if the prerequisite was updated. Because $(LIBBPF)-clean is not a
> file, the recipe is always run and adding the | doesn't make a difference.

I know. I wanted it just for consistency, because everything after |
means "make sure it's completed, but it's not my direct input". But
I'm ok either way, it's not that important. Also $(LIBBPF)-clean and
$(LIBBPF_BOOTSTRAP)-clean should be .PHONY targets, but then again in
practice won't matter, because unlikely that we'll have such files.
Would be nice to follow up with a fix, but I'll apply your patch set
as is.

>
> Thanks,
> Jean

  reply	other threads:[~2020-11-11 18:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 16:43 [PATCH bpf-next v3 0/7] tools/bpftool: Some build fixes Jean-Philippe Brucker
2020-11-10 16:43 ` [PATCH bpf-next v3 1/7] tools: Factor HOSTCC, HOSTLD, HOSTAR definitions Jean-Philippe Brucker
2020-11-10 16:43 ` [PATCH bpf-next v3 2/7] tools/bpftool: Force clean of out-of-tree build Jean-Philippe Brucker
2020-11-11  4:57   ` Andrii Nakryiko
2020-11-11  8:54     ` Jean-Philippe Brucker
2020-11-11 18:22       ` Andrii Nakryiko [this message]
2020-11-10 16:43 ` [PATCH bpf-next v3 3/7] tools/bpftool: Fix cross-build Jean-Philippe Brucker
2020-11-11  5:04   ` Andrii Nakryiko
2020-11-11 20:50   ` Andrii Nakryiko
2020-11-10 16:43 ` [PATCH bpf-next v3 4/7] tools/runqslower: Use Makefile.include Jean-Philippe Brucker
2020-11-11  5:06   ` Andrii Nakryiko
2020-11-10 16:43 ` [PATCH bpf-next v3 5/7] tools/runqslower: Enable out-of-tree build Jean-Philippe Brucker
2020-11-11  5:11   ` Andrii Nakryiko
2020-11-11  8:53     ` Jean-Philippe Brucker
2020-11-11 18:23       ` Andrii Nakryiko
2020-11-10 16:43 ` [PATCH bpf-next v3 6/7] tools/runqslower: Build bpftool using HOSTCC Jean-Philippe Brucker
2020-11-11  5:11   ` Andrii Nakryiko
2020-11-10 16:43 ` [PATCH bpf-next v3 7/7] tools/bpftool: Fix build slowdown Jean-Philippe Brucker
2020-11-11  5:12   ` Andrii Nakryiko
2020-11-11 20:40 ` [PATCH bpf-next v3 0/7] tools/bpftool: Some build fixes patchwork-bot+netdevbpf

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='CAEf4BzZqiFeLVYq-X7Z7cypRYSgLFw3dr=-EEoyzWaDJVFfzug@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jean-philippe@linaro.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.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 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.