mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: TJ <linux@iam.tj>
To: linux-kernel@vger.kernel.org
Subject: Re: Bug 116411: tools/perf_clean: output directory does not exist. Stop.
Date: Fri, 15 Apr 2016 21:06:49 +0100	[thread overview]
Message-ID: <fdf312364a3751a4a9beb60c117a835a@iam.tj> (raw)

Thanks for looking at this; I've become lost in Makefile hell trying to 
figure it out :)

On 15-04-2016 17:00, Arnaldo Carvalho de Melo wrote:
> Em Fri, Apr 15, 2016 at 03:21:35PM +0100, TJ escreveu:
>> v4.6-rc3
>> tools/perf then tools/perf_clean fails in the source tree:
>> *** output directory
>> "/home/all/SourceCode/linux/linux/tools/perf/tools/perf/" does not 
>> exist.
>> Stop.
>> https://bugzilla.kernel.org/show_bug.cgi?id=116411

----8-<---- snip

> I can reproduce the:
> [acme@jouet linux]$ rm -rf ../build/perf
>   [acme@jouet linux]$ mkdir ../build/perf
>   [acme@jouet linux]$ make O=../build/perf -C tools/perf
>   make: Entering directory '/home/acme/git/linux/tools/perf'
>     BUILD:   Doing 'make -j4' parallel build
>   ../scripts/Makefile.include:3: ***
> O=/home/acme/git/linux/tools/build/perf does not exist.  Stop.

----8-<---- snip
>> git blame shows commits c883122a and bf35182f are responsible for the 
>> path
>> calculation code.
> Thanks for narrowing it down, do you have any patch fixing this?

Over the last week I've exhaustively tried several alternative 
approaches, based around the idea of capturing the initial launch 
command-line O= value (since changing that for sub-makes is the problem 
here), but I've not been able to come up with a solution that works for 
all cases (srctree {relative,absolute} path or objtree 
{relative,absolute} path).

I'm also basing the command-line on the help from ./tools/Makefile 
which recommends:

   @echo ' $$ make -C tools/ <tool>_install'

I've added extensive debugging to track the changing variables from 
./tools/scripts/Makefile.include. The most successful for most 
situations (when starting from the base ./Makefile) captures BASE_O and 
then uses it for creating all paths, but the various subtle interactions 
of $(subdir) and the sub-makes, $(objtree), and others causes 
regressions such as generating output to the wrong directory.

diff --git a/tools/scripts/Makefile.include 
b/tools/scripts/Makefile.include
index 8abbef1..871c183 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -1,7 +1,11 @@
  ifneq ($(O),)
  ifeq ($(origin O), command line)
-       dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) 
does not exist),)
-       ABSOLUTE_O := $(shell cd $(O) ; pwd)
+ifeq ($(BASE_O),)
+       export BASE_O := $(abspath $(if $(filter ..% 
.%,$(O)),$(srctree)/$(O),$(O)))
+endif
+  __T := $(info BASE_O=$(BASE_O))
+       dummy := $(if $(shell test -d $(BASE_O) || echo 
$(BASE_O)),$(error BASE_O=$(BASE_O) does not exist),)
+       ABSOLUTE_O := $(shell cd $(BASE_O) ; pwd)
         OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
         COMMAND_O := O=$(ABSOLUTE_O)
  ifeq ($(objtree),)


Basing paths on BASE_O will fail (with incorrect paths) when starting 
the build directly with -C ./tools/ or  -C ./tools/perf/ -  it has felt 
like playing whack-a -mole!

             reply	other threads:[~2016-04-15 20:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 20:06 TJ [this message]
     [not found] <9e79969b0c42c9a9454a8838451945ce@iam.tj>
     [not found] ` <20160415160002.GP9056@kernel.org>
2016-04-17  0:31   ` TJ
  -- strict thread matches above, loose matches on Subject: below --
2016-04-15 20:05 TJ

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=fdf312364a3751a4a9beb60c117a835a@iam.tj \
    --to=linux@iam.tj \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®