linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Borislav Petkov <bp@amd64.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Michal Marek <mmarek@suse.cz>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 5/5] tools: Connect to the kernel build system
Date: Thu, 12 Apr 2012 17:57:34 +0200	[thread overview]
Message-ID: <20120412155734.GA30170@merkur.ravnborg.org> (raw)
In-Reply-To: <20120412152256.GH24549@aftab>

> --
> From: Borislav Petkov <borislav.petkov@amd.com>
> Date: Thu, 12 Apr 2012 17:18:10 +0200
> Subject: [PATCH] tools, Makefile: Fix O= building
> 
> Make sure
> 
> $ make O=/tmp/somedir tools/perf
> 
> works with the current toplevel Makefile integration.
> 
> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> ---
>  Makefile                       |    9 +++++++--
>  tools/scripts/Makefile.include |   18 +++++++++++++++---
>  2 files changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 23b9ce5a2c2c..2cb2ee2dc6ae 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -98,8 +98,13 @@ ifeq ($(KBUILD_SRC),)
>  
>  # OK, Make called in directory where kernel src resides
>  # Do we want to locate output files in a separate directory?
> +#
> +# Also, we don't want to set KBUILD_OUTPUT if we're building stuff
> +# in tools/
>  ifeq ("$(origin O)", "command line")
> -  KBUILD_OUTPUT := $(O)
> +  ifneq ($(findstring tools/,$(MAKECMDGOALS)),tools/)
> +    KBUILD_OUTPUT := $(O)
> +  endif
>  endif
It is complicated enough - this is not OK.
We cannot special case individual targets here...

>  
>  ifeq ("$(origin W)", "command line")
> @@ -1473,7 +1478,7 @@ tools/: FORCE
>  	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/
>  
>  tools/%: FORCE
> -	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
> +	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(O) -C $(src)/tools/ $*

I think we can do:
> +	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(KBUILD_OUTPUT) -C $(src)/tools/ $*
And then avoid the hacks above.


>  
>  # Single targets
>  # ---------------------------------------------------------------------------
> diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
> index 87b55a729a5f..297b51d8e4be 100644
> --- a/tools/scripts/Makefile.include
> +++ b/tools/scripts/Makefile.include
> @@ -38,11 +38,18 @@ else
>  NO_SUBDIR = :
>  endif
>  
> -QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
> -QUIET_SUBDIR1  =

Who-ever came up with the names "QUIET_SUBDIR" must have had a bad day...
I think you could do all the tricks using:

QUIET_MAKE = ...

It looks much simpler to use:

foo: bar
	$(QUIET_MAKE) ...

But this is another patch...

	Sam

  reply	other threads:[~2012-04-12 15:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 16:36 [PATCH v5 0/5] tools: Add a toplevel Makefile Borislav Petkov
2012-04-11 16:36 ` [PATCH v5 1/5] tools: Add Makefile.include Borislav Petkov
2012-04-13 18:14   ` [tip:perf/core] " tip-bot for Borislav Petkov
2012-04-11 16:36 ` [PATCH v5 2/5] tools: Cleanup EXTRA_WARNINGS Borislav Petkov
2012-04-13 18:15   ` [tip:perf/core] " tip-bot for Borislav Petkov
2012-04-11 16:36 ` [PATCH v5 3/5] tools: Add a toplevel Makefile Borislav Petkov
2012-04-13 18:16   ` [tip:perf/core] " tip-bot for Borislav Petkov
2012-04-11 16:36 ` [PATCH v5 4/5] tools: Add a help target Borislav Petkov
2012-04-13 18:17   ` [tip:perf/core] " tip-bot for Borislav Petkov
2012-04-11 16:36 ` [PATCH v5 5/5] tools: Connect to the kernel build system Borislav Petkov
2012-04-11 18:04   ` Arnaldo Carvalho de Melo
2012-04-11 18:08     ` Arnaldo Carvalho de Melo
2012-04-11 18:19       ` David Ahern
2012-04-11 19:45         ` Borislav Petkov
2012-04-11 19:52         ` Arnaldo Carvalho de Melo
2012-04-12 15:22       ` Borislav Petkov
2012-04-12 15:57         ` Sam Ravnborg [this message]
2012-04-12 18:33           ` Arnaldo Carvalho de Melo
2012-04-12 19:16             ` Sam Ravnborg
2012-04-12 19:31               ` Arnaldo Carvalho de Melo
2012-04-12 21:17             ` Alex Riesen
2012-04-13 10:45           ` Borislav Petkov
2012-04-11 19:47     ` Borislav Petkov
2012-04-13 18:18   ` [tip:perf/core] " tip-bot for Borislav Petkov
2012-04-14  6:35     ` Alex Riesen

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=20120412155734.GA30170@merkur.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=acme@infradead.org \
    --cc=bp@amd64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mmarek@suse.cz \
    /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).