All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/5] tools: Add a toplevel Makefile
@ 2012-04-11 16:36 Borislav Petkov
  2012-04-11 16:36 ` [PATCH v5 1/5] tools: Add Makefile.include Borislav Petkov
                   ` (4 more replies)
  0 siblings, 5 replies; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 16:36 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo, Michal Marek, Sam Ravnborg
  Cc: LKML, Borislav Petkov

From: Borislav Petkov <borislav.petkov@amd.com>

Hi all,

this is v5 of the patchset incorporating most of Sam's comments from
yesterday.

Changelog:
==========

* v4:

this is basically a new rediff of the patchset against 3.4-rc2 along
with integrating all comments/reviews I got from the last iteration. If
there are none this time, I would like to suggest merging this, maybe
through -tip or Arnaldo's perf tree.

State of the affairs on how to use it are in the 4/4 patch, adding them
here too:

Now you can do

$ make tools/<toolname>

from the toplevel kernel directory and have the respective tool built.

If you want to build and install it, do

$ make tools/<toolname>_install

$ make tools/<toolname>_clean

should clean the respective tool directories.

If you want to clean all in tools, simply do

$ make tools/clean

Also, if you want to get what the possible targets are, simply calling

$ make tools/

should give you the short help.

$ make tools/install

installs all tools, of course. Doh.

Thanks.

* v3:

Yet another version of the toplevel Makefile integration of tools/.
This round gives you the ability to build the tools from the toplevel
Makefile (explanation below can be found also in patch 4/4's commit
message):

"Now you can do

$ make tools/<toolname>

from the toplevel kernel directory and have the respective tool built.

If you want to build and install it, do

$ make tools/<toolname> tinstall

The install target is called "tinstall" so that there's no conflict with
the main kernel install target and should mean "tool install".

$ make tools/ <toolname>_clean

should clean the respective tool directories.

If you want to clean all in tools, simply do

$ make  tools/ cleanall

Also, if you want to get what the possible targets are, simply calling

$ make tools/

should give you the short help."

Also included are all suggestions from the last time.

Thanks.

* v2:

here's a refreshed version from yesterday incorporating all comments and
suggestions along with a third patch that adds a 'help' target as the
default one causing the following below. Btw, Arnaldo, could you please
pick those up if there are no complaints since the first patch touches
perf and I don't have a clear idea who else to send it to anyway :).

Thanks.

$ make
Possible targets:

  cpupower   - a tool for all things x86 CPU power
  firewire   - the userspace part of nosy, an IEEE-1394 traffic sniffer
  lguest     - a minimal 32-bit x86 hypervisor
  perf       - Linux performance measurements tool
  slub       - slabs reporting tool
  turbostat  - Intel CPU idle stats and freq reporting tool
  usb        - USB testing tools
  virtio     - vhost test module
  x86_energy_perf_policy - Intel energy policy tool

Cleaning targets:

  all of the above with the "_clean" string appended cleans
    the respective build directory.
  clean: a summary clean target to clean _all_ folders


* v1:

this is a refresh and carve-out of an old patchset. It adds a toplevel
Makefile to tools/ so that one can build the tool of her/his liking by
simply doing

$ cd tools/
$ make <toolname>

By default, we build perf. There's also a scripts/Makefile.lib now which
should contain all make-related generic stuff which can be used by all
tools' build process after including this file.

</Changelog>

Any comments/suggestions are welcome,
thanks.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH v5 1/5] tools: Add Makefile.include
  2012-04-11 16:36 [PATCH v5 0/5] tools: Add a toplevel Makefile Borislav Petkov
@ 2012-04-11 16:36 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 16:36 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo, Michal Marek, Sam Ravnborg
  Cc: LKML, Borislav Petkov

From: Borislav Petkov <borislav.petkov@amd.com>

Put generic enough build settings which could be reused by other tools
into a common Makefile.include file.

This commit reintroduces QUIET_SUBDIR{0,1} (see a3d1ee10d1bf) which are
going to be used in the following patches.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 tools/perf/Makefile            |   47 +--------------------------------
 tools/scripts/Makefile.include |   57 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 46 deletions(-)
 create mode 100644 tools/scripts/Makefile.include

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 820371f10d1b..4ca77cc0f284 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -1,18 +1,10 @@
-ifeq ("$(origin O)", "command line")
-	OUTPUT := $(O)/
-endif
+include ../scripts/Makefile.include
 
 # The default target of this Makefile is...
 all:
 
 include config/utilities.mak
 
-ifneq ($(OUTPUT),)
-# check that the output directory actually exists
-OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
-$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
-endif
-
 # Define V to have a more verbose compile.
 #
 # Define O to save output files in a separate directory.
@@ -84,31 +76,6 @@ ifneq ($(WERROR),0)
 	CFLAGS_WERROR := -Werror
 endif
 
-#
-# Include saner warnings here, which can catch bugs:
-#
-
-EXTRA_WARNINGS := -Wformat
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
-
 ifeq ("$(origin DEBUG)", "command line")
   PERF_DEBUG = $(DEBUG)
 endif
@@ -679,18 +646,6 @@ else
 	endif
 endif
 
-ifneq ($(findstring $(MAKEFLAGS),s),s)
-ifndef V
-	QUIET_CC       = @echo '   ' CC $@;
-	QUIET_AR       = @echo '   ' AR $@;
-	QUIET_LINK     = @echo '   ' LINK $@;
-	QUIET_MKDIR    = @echo '   ' MKDIR $@;
-	QUIET_GEN      = @echo '   ' GEN $@;
-	QUIET_FLEX     = @echo '   ' FLEX $@;
-	QUIET_BISON    = @echo '   ' BISON $@;
-endif
-endif
-
 ifdef ASCIIDOC8
 	export ASCIIDOC8
 endif
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
new file mode 100644
index 000000000000..52348d3bd8d3
--- /dev/null
+++ b/tools/scripts/Makefile.include
@@ -0,0 +1,57 @@
+ifeq ("$(origin O)", "command line")
+	OUTPUT := $(O)/
+endif
+
+ifneq ($(OUTPUT),)
+# check that the output directory actually exists
+OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
+$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
+endif
+
+#
+# Include saner warnings here, which can catch bugs:
+#
+EXTRA_WARNINGS := -Wformat
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
+
+ifneq ($(findstring $(MAKEFLAGS), w),w)
+PRINT_DIR = --no-print-directory
+else
+NO_SUBDIR = :
+endif
+
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+	QUIET_CC       = @echo '   ' CC $@;
+	QUIET_AR       = @echo '   ' AR $@;
+	QUIET_LINK     = @echo '   ' LINK $@;
+	QUIET_MKDIR    = @echo '   ' MKDIR $@;
+	QUIET_GEN      = @echo '   ' GEN $@;
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+	QUIET_FLEX     = @echo '   ' FLEX $@;
+	QUIET_BISON    = @echo '   ' BISON $@;
+endif
+endif
-- 
1.7.9.3.362.g71319


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v5 2/5] tools: Cleanup EXTRA_WARNINGS
  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-11 16:36 ` 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
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 16:36 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo, Michal Marek, Sam Ravnborg
  Cc: LKML, Borislav Petkov

From: Borislav Petkov <borislav.petkov@amd.com>

Use += instead of the bash syntax, as Sam Ravnborg suggests. Also, sort
the -W options alphabetically and (... keep them sorted).

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 tools/scripts/Makefile.include |   40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 52348d3bd8d3..87b55a729a5f 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -11,26 +11,26 @@ endif
 #
 # Include saner warnings here, which can catch bugs:
 #
-EXTRA_WARNINGS := -Wformat
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
+EXTRA_WARNINGS := -Wbad-function-cast
+EXTRA_WARNINGS += -Wdeclaration-after-statement
+EXTRA_WARNINGS += -Wformat-security
+EXTRA_WARNINGS += -Wformat-y2k
+EXTRA_WARNINGS += -Winit-self
+EXTRA_WARNINGS += -Wmissing-declarations
+EXTRA_WARNINGS += -Wmissing-prototypes
+EXTRA_WARNINGS += -Wnested-externs
+EXTRA_WARNINGS += -Wno-system-headers
+EXTRA_WARNINGS += -Wold-style-definition
+EXTRA_WARNINGS += -Wpacked
+EXTRA_WARNINGS += -Wredundant-decls
+EXTRA_WARNINGS += -Wshadow
+EXTRA_WARNINGS += -Wstrict-aliasing=3
+EXTRA_WARNINGS += -Wstrict-prototypes
+EXTRA_WARNINGS += -Wswitch-default
+EXTRA_WARNINGS += -Wswitch-enum
+EXTRA_WARNINGS += -Wundef
+EXTRA_WARNINGS += -Wwrite-strings
+EXTRA_WARNINGS += -Wformat
 
 ifneq ($(findstring $(MAKEFLAGS), w),w)
 PRINT_DIR = --no-print-directory
-- 
1.7.9.3.362.g71319


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v5 3/5] tools: Add a toplevel Makefile
  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-11 16:36 ` [PATCH v5 2/5] tools: Cleanup EXTRA_WARNINGS Borislav Petkov
@ 2012-04-11 16:36 ` 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-11 16:36 ` [PATCH v5 5/5] tools: Connect to the kernel build system Borislav Petkov
  4 siblings, 1 reply; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 16:36 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo, Michal Marek, Sam Ravnborg
  Cc: LKML, Borislav Petkov

From: Borislav Petkov <borislav.petkov@amd.com>

Add a Makefile with all the targets under tools/.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 tools/Makefile |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 tools/Makefile

diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644
index 000000000000..feadfdd6da55
--- /dev/null
+++ b/tools/Makefile
@@ -0,0 +1,47 @@
+include scripts/Makefile.include
+
+cpupower: FORCE
+	$(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1)
+
+firewire lguest perf usb virtio vm: FORCE
+	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
+
+selftests: FORCE
+	$(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1)
+
+turbostat x86_energy_perf_policy: FORCE
+	$(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1)
+
+cpupower_install:
+	$(QUIET_SUBDIR0)power/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+firewire_install lguest_install perf_install usb_install virtio_install vm_install:
+	$(QUIET_SUBDIR0)$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+selftests_install:
+	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) install
+
+turbostat_install x86_energy_perf_policy_install:
+	$(QUIET_SUBDIR0)power/x86/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+install: cpupower_install firewire_install lguest_install perf_install \
+		selftests_install turbostat_install usb_install virtio_install \
+		vm_install x86_energy_perf_policy_install
+
+cpupower_clean:
+	$(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean
+
+firewire_clean lguest_clean perf_clean usb_clean virtio_clean vm_clean:
+	$(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+selftests_clean:
+	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+turbostat_clean x86_energy_perf_policy_clean:
+	$(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+clean: cpupower_clean firewire_clean lguest_clean perf_clean selftests_clean \
+		turbostat_clean usb_clean virtio_clean vm_clean \
+		x86_energy_perf_policy_clean
+
+.PHONY: FORCE
-- 
1.7.9.3.362.g71319


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v5 4/5] tools: Add a help target
  2012-04-11 16:36 [PATCH v5 0/5] tools: Add a toplevel Makefile Borislav Petkov
                   ` (2 preceding siblings ...)
  2012-04-11 16:36 ` [PATCH v5 3/5] tools: Add a toplevel Makefile Borislav Petkov
@ 2012-04-11 16:36 ` 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
  4 siblings, 1 reply; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 16:36 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo, Michal Marek, Sam Ravnborg
  Cc: LKML, Borislav Petkov

From: Borislav Petkov <borislav.petkov@amd.com>

... and make it the default one so that calling 'make' without arguments
in the tools/ directory gives you the possible targets to build along
with a short description of what they are.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 tools/Makefile |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/Makefile b/tools/Makefile
index feadfdd6da55..f87c0ec63e6c 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,5 +1,25 @@
 include scripts/Makefile.include
 
+help:
+	@echo 'Possible targets:'
+	@echo ''
+	@echo '  cpupower   - a tool for all things x86 CPU power'
+	@echo '  firewire   - the userspace part of nosy, an IEEE-1394 traffic sniffer'
+	@echo '  lguest     - a minimal 32-bit x86 hypervisor'
+	@echo '  perf       - Linux performance measurement and analysis tool'
+	@echo '  selftests  - various kernel selftests'
+	@echo '  turbostat  - Intel CPU idle stats and freq reporting tool'
+	@echo '  usb        - USB testing tools'
+	@echo '  virtio     - vhost test module'
+	@echo '  vm         - misc vm tools'
+	@echo '  x86_energy_perf_policy - Intel energy policy tool'
+	@echo ''
+	@echo 'Cleaning targets:'
+	@echo ''
+	@echo '  all of the above with the "_clean" string appended cleans'
+	@echo '    the respective build directory.'
+	@echo '  clean: a summary clean target to clean _all_ folders'
+
 cpupower: FORCE
 	$(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1)
 
-- 
1.7.9.3.362.g71319


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-11 16:36 [PATCH v5 0/5] tools: Add a toplevel Makefile Borislav Petkov
                   ` (3 preceding siblings ...)
  2012-04-11 16:36 ` [PATCH v5 4/5] tools: Add a help target Borislav Petkov
@ 2012-04-11 16:36 ` Borislav Petkov
  2012-04-11 18:04   ` Arnaldo Carvalho de Melo
  2012-04-13 18:18   ` [tip:perf/core] " tip-bot for Borislav Petkov
  4 siblings, 2 replies; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 16:36 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo, Michal Marek, Sam Ravnborg
  Cc: LKML, Borislav Petkov

From: Borislav Petkov <borislav.petkov@amd.com>

Now you can do

$ make tools/<toolname>

from the toplevel kernel directory and have the respective tool built.

If you want to build and install it, do

$ make tools/<toolname>_install

$ make tools/<toolname>_clean

should clean the respective tool directories.

If you want to clean all in tools, simply do

$ make tools/clean

Also, if you want to get what the possible targets are, simply calling

$ make tools/

should give you the short help.

$ make tools/install

installs all tools, of course. Doh.

Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 Makefile       |    7 +++++++
 tools/Makefile |   10 ++++++++++
 2 files changed, 17 insertions(+)

diff --git a/Makefile b/Makefile
index 0df3d003a079..f7f738117128 100644
--- a/Makefile
+++ b/Makefile
@@ -1468,6 +1468,13 @@ kernelrelease:
 kernelversion:
 	@echo $(KERNELVERSION)
 
+# Clear a bunch of variables before executing the submake
+tools/: FORCE
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/
+
+tools/%: FORCE
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
+
 # Single targets
 # ---------------------------------------------------------------------------
 # Single targets are compatible with:
diff --git a/tools/Makefile b/tools/Makefile
index f87c0ec63e6c..3ae43947a171 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -14,6 +14,16 @@ help:
 	@echo '  vm         - misc vm tools'
 	@echo '  x86_energy_perf_policy - Intel energy policy tool'
 	@echo ''
+	@echo 'You can do:'
+	@echo ' $$ make -C tools/<tool>_install'
+	@echo ''
+	@echo '  from the kernel command line to build and install one of'
+	@echo '  the tools above'
+	@echo ''
+	@echo '  $$ make tools/install'
+	@echo ''
+	@echo '  installs all tools.'
+	@echo ''
 	@echo 'Cleaning targets:'
 	@echo ''
 	@echo '  all of the above with the "_clean" string appended cleans'
-- 
1.7.9.3.362.g71319


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  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 19:47     ` Borislav Petkov
  2012-04-13 18:18   ` [tip:perf/core] " tip-bot for Borislav Petkov
  1 sibling, 2 replies; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-11 18:04 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Ingo Molnar, Michal Marek, Sam Ravnborg, LKML, Borislav Petkov

Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:
> From: Borislav Petkov <borislav.petkov@amd.com>
> 
> Now you can do
> 
> $ make tools/<toolname>
> 
> from the toplevel kernel directory and have the respective tool built.
> 
> If you want to build and install it, do
> 
> $ make tools/<toolname>_install

[acme@sandy linux]$ make -j8 O=/home/git/build/perf tools/perf_install
[acme@sandy linux]$ ls -la tools/perf/*.o | wc -l
22

It should have honoured O=

Can you fix this one please? :)

- Arnaldo
 
> $ make tools/<toolname>_clean
> 
> should clean the respective tool directories.
> 
> If you want to clean all in tools, simply do
> 
> $ make tools/clean
> 
> Also, if you want to get what the possible targets are, simply calling
> 
> $ make tools/
> 
> should give you the short help.
> 
> $ make tools/install
> 
> installs all tools, of course. Doh.
> 
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> ---
>  Makefile       |    7 +++++++
>  tools/Makefile |   10 ++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 0df3d003a079..f7f738117128 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1468,6 +1468,13 @@ kernelrelease:
>  kernelversion:
>  	@echo $(KERNELVERSION)
>  
> +# Clear a bunch of variables before executing the submake
> +tools/: FORCE
> +	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/
> +
> +tools/%: FORCE
> +	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
> +
>  # Single targets
>  # ---------------------------------------------------------------------------
>  # Single targets are compatible with:
> diff --git a/tools/Makefile b/tools/Makefile
> index f87c0ec63e6c..3ae43947a171 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -14,6 +14,16 @@ help:
>  	@echo '  vm         - misc vm tools'
>  	@echo '  x86_energy_perf_policy - Intel energy policy tool'
>  	@echo ''
> +	@echo 'You can do:'
> +	@echo ' $$ make -C tools/<tool>_install'
> +	@echo ''
> +	@echo '  from the kernel command line to build and install one of'
> +	@echo '  the tools above'
> +	@echo ''
> +	@echo '  $$ make tools/install'
> +	@echo ''
> +	@echo '  installs all tools.'
> +	@echo ''
>  	@echo 'Cleaning targets:'
>  	@echo ''
>  	@echo '  all of the above with the "_clean" string appended cleans'
> -- 
> 1.7.9.3.362.g71319

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  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-12 15:22       ` Borislav Petkov
  2012-04-11 19:47     ` Borislav Petkov
  1 sibling, 2 replies; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-11 18:08 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Ingo Molnar, Michal Marek, Sam Ravnborg, LKML, Borislav Petkov

Em Wed, Apr 11, 2012 at 03:04:34PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:
> > From: Borislav Petkov <borislav.petkov@amd.com>
> > 
> > Now you can do
> > 
> > $ make tools/<toolname>
> > 
> > from the toplevel kernel directory and have the respective tool built.
> > 
> > If you want to build and install it, do
> > 
> > $ make tools/<toolname>_install
> 
> [acme@sandy linux]$ make -j8 O=/home/git/build/perf tools/perf_install
> [acme@sandy linux]$ ls -la tools/perf/*.o | wc -l
> 22
> 
> It should have honoured O=
> 
> Can you fix this one please? :)

But that can be on top of this series as the way I use it:

  make -j8 -C tools/perf/ O=/home/git/build/perf install

still works as expected.

So if nobody hollers I'll push this to Ingo in my next pull req, ok?

Sam? Ingo? Do you still have any concerns?

- Arnaldo
 
> - Arnaldo
>  
> > $ make tools/<toolname>_clean
> > 
> > should clean the respective tool directories.
> > 
> > If you want to clean all in tools, simply do
> > 
> > $ make tools/clean
> > 
> > Also, if you want to get what the possible targets are, simply calling
> > 
> > $ make tools/
> > 
> > should give you the short help.
> > 
> > $ make tools/install
> > 
> > installs all tools, of course. Doh.
> > 
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> > ---
> >  Makefile       |    7 +++++++
> >  tools/Makefile |   10 ++++++++++
> >  2 files changed, 17 insertions(+)
> > 
> > diff --git a/Makefile b/Makefile
> > index 0df3d003a079..f7f738117128 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1468,6 +1468,13 @@ kernelrelease:
> >  kernelversion:
> >  	@echo $(KERNELVERSION)
> >  
> > +# Clear a bunch of variables before executing the submake
> > +tools/: FORCE
> > +	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/
> > +
> > +tools/%: FORCE
> > +	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
> > +
> >  # Single targets
> >  # ---------------------------------------------------------------------------
> >  # Single targets are compatible with:
> > diff --git a/tools/Makefile b/tools/Makefile
> > index f87c0ec63e6c..3ae43947a171 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -14,6 +14,16 @@ help:
> >  	@echo '  vm         - misc vm tools'
> >  	@echo '  x86_energy_perf_policy - Intel energy policy tool'
> >  	@echo ''
> > +	@echo 'You can do:'
> > +	@echo ' $$ make -C tools/<tool>_install'
> > +	@echo ''
> > +	@echo '  from the kernel command line to build and install one of'
> > +	@echo '  the tools above'
> > +	@echo ''
> > +	@echo '  $$ make tools/install'
> > +	@echo ''
> > +	@echo '  installs all tools.'
> > +	@echo ''
> >  	@echo 'Cleaning targets:'
> >  	@echo ''
> >  	@echo '  all of the above with the "_clean" string appended cleans'
> > -- 
> > 1.7.9.3.362.g71319

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  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
  1 sibling, 2 replies; 25+ messages in thread
From: David Ahern @ 2012-04-11 18:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Borislav Petkov, Ingo Molnar, Michal Marek, Sam Ravnborg, LKML,
	Borislav Petkov

On 4/11/12 12:08 PM, Arnaldo Carvalho de Melo wrote:

>> [acme@sandy linux]$ make -j8 O=/home/git/build/perf tools/perf_install
>> [acme@sandy linux]$ ls -la tools/perf/*.o | wc -l
>> 22
>>
>> It should have honoured O=
>>
>> Can you fix this one please? :)
>
> But that can be on top of this series as the way I use it:
>
>    make -j8 -C tools/perf/ O=/home/git/build/perf install
>
> still works as expected.

Does this sequence still work?

cd tools/perf
make O=/tmp/pbuild

and the O= is honored?

David

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-11 18:19       ` David Ahern
@ 2012-04-11 19:45         ` Borislav Petkov
  2012-04-11 19:52         ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 19:45 UTC (permalink / raw)
  To: David Ahern
  Cc: Arnaldo Carvalho de Melo, Borislav Petkov, Ingo Molnar,
	Michal Marek, Sam Ravnborg, LKML

On Wed, Apr 11, 2012 at 12:19:15PM -0600, David Ahern wrote:
> Does this sequence still work?
> 
> cd tools/perf
> make O=/tmp/pbuild
> 
> and the O= is honored?

That still works:

$ cd tools/perf/
$ mkdir /tmp/pbuild
$ make O=/tmp/pbuild
    MKDIR /tmp/pbuild/arch/x86/util
    MKDIR /tmp/pbuild/bench
    MKDIR /tmp/pbuild/util
    MKDIR /tmp/pbuild/util/ui
    MKDIR /tmp/pbuild/util/ui/browsers
PERF_VERSION = 3.4.rc2.28.g7f953

...

    CC /tmp/pbuild/util/ui/browsers/map.o
    CC /tmp/pbuild/util/ui/helpline.o
    CC /tmp/pbuild/util/ui/progress.o
    CC /tmp/pbuild/util/ui/util.o
    AR /tmp/pbuild/libperf.a
    LINK /tmp/pbuild/perf
    GEN perf-archive

$ ls -al /tmp/pbuild/*.o | wc -l
22

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-11 18:04   ` Arnaldo Carvalho de Melo
  2012-04-11 18:08     ` Arnaldo Carvalho de Melo
@ 2012-04-11 19:47     ` Borislav Petkov
  1 sibling, 0 replies; 25+ messages in thread
From: Borislav Petkov @ 2012-04-11 19:47 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Michal Marek, Sam Ravnborg, LKML, Borislav Petkov

On Wed, Apr 11, 2012 at 03:04:34PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:
> > From: Borislav Petkov <borislav.petkov@amd.com>
> > 
> > Now you can do
> > 
> > $ make tools/<toolname>
> > 
> > from the toplevel kernel directory and have the respective tool built.
> > 
> > If you want to build and install it, do
> > 
> > $ make tools/<toolname>_install
> 
> [acme@sandy linux]$ make -j8 O=/home/git/build/perf tools/perf_install
> [acme@sandy linux]$ ls -la tools/perf/*.o | wc -l
> 22
> 
> It should have honoured O=
> 
> Can you fix this one please? :)

I should've known - never break Arnaldo's O= thing! :-)

Sure, I'll take a look at it and I agree, it can go ontop.

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-11 18:19       ` David Ahern
  2012-04-11 19:45         ` Borislav Petkov
@ 2012-04-11 19:52         ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-11 19:52 UTC (permalink / raw)
  To: David Ahern
  Cc: Borislav Petkov, Ingo Molnar, Michal Marek, Sam Ravnborg, LKML,
	Borislav Petkov

Em Wed, Apr 11, 2012 at 12:19:15PM -0600, David Ahern escreveu:
> On 4/11/12 12:08 PM, Arnaldo Carvalho de Melo wrote:
> 
> >>[acme@sandy linux]$ make -j8 O=/home/git/build/perf tools/perf_install
> >>[acme@sandy linux]$ ls -la tools/perf/*.o | wc -l
> >>22
> >>
> >>It should have honoured O=
> >>
> >>Can you fix this one please? :)
> >
> >But that can be on top of this series as the way I use it:
> >
> >   make -j8 -C tools/perf/ O=/home/git/build/perf install
> >
> >still works as expected.
> 
> Does this sequence still work?
> 
> cd tools/perf
> make O=/tmp/pbuild
> 
> and the O= is honored?

Yes:

[acme@sandy linux]$ mkdir /tmp/perf
[acme@sandy linux]$ cd tools/perf
[acme@sandy perf]$ make O=/tmp/perf
    MKDIR /tmp/perf/arch/x86/util
<SNIP>
    MKDIR /tmp/perf/util/ui/browsers
PERF_VERSION = perf.core.for.mingo.6.gea01fa
    GEN /tmp/perf/common-cmds.h
    * new build flags or prefix
    CC /tmp/perf/perf.o
    CC /tmp/perf/builtin-annotate.o
<SNIP>
    CC /tmp/perf/util/parse-options.o
    BISON event-parser
    FLEX event-parser
    BISON pmu-parser
    FLEX pmu-parser
    CC /tmp/perf/util/parse-events.o
<SNIP>
    AR /tmp/perf/libperf.a
    LINK /tmp/perf/perf
    GEN perf-archive
    GEN /tmp/perf/python/perf.so
[acme@sandy perf]$ 
[acme@sandy perf]$ /tmp/perf/perf --version
perf version perf.core.for.mingo.6.gea01fa
[acme@sandy perf]$

- Arnaldo

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-11 18:08     ` Arnaldo Carvalho de Melo
  2012-04-11 18:19       ` David Ahern
@ 2012-04-12 15:22       ` Borislav Petkov
  2012-04-12 15:57         ` Sam Ravnborg
  1 sibling, 1 reply; 25+ messages in thread
From: Borislav Petkov @ 2012-04-12 15:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Borislav Petkov, Ingo Molnar, Michal Marek, Sam Ravnborg, LKML

On Wed, Apr 11, 2012 at 03:08:37PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 11, 2012 at 03:04:34PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:
> > > From: Borislav Petkov <borislav.petkov@amd.com>
> > > 
> > > Now you can do
> > > 
> > > $ make tools/<toolname>
> > > 
> > > from the toplevel kernel directory and have the respective tool built.
> > > 
> > > If you want to build and install it, do
> > > 
> > > $ make tools/<toolname>_install
> > 
> > [acme@sandy linux]$ make -j8 O=/home/git/build/perf tools/perf_install
> > [acme@sandy linux]$ ls -la tools/perf/*.o | wc -l
> > 22
> > 
> > It should have honoured O=
> > 
> > Can you fix this one please? :)
> 
> But that can be on top of this series as the way I use it:

How about the patch below? Sam, it touches the toplevel Makefile because
it needs to not set KBUILD_OUTPUT when we're building tools/* targets.
Pls, let me know if this is ok?

Thanks.

--
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
 
 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/ $*
 
 # 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  =
 
 ifneq ($(findstring $(MAKEFLAGS),s),s)
-ifndef V
+ifdef V
+	QUIET_SUBDIR0  = +$(MAKE)
+	QUIET_SUBDIR1  =
+
+	ifdef O
+	  QUIET_SUBDIR0 += O=$(O)
+	endif
+
+	QUIET_SUBDIR0 += -C # space to separate -C and subdir
+else
 	QUIET_CC       = @echo '   ' CC $@;
 	QUIET_AR       = @echo '   ' AR $@;
 	QUIET_LINK     = @echo '   ' LINK $@;
@@ -51,6 +58,11 @@ ifndef V
 	QUIET_SUBDIR0  = +@subdir=
 	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 			 $(MAKE) $(PRINT_DIR) -C $$subdir
+
+	ifdef O
+	  QUIET_SUBDIR1 += O=$(O)
+	endif
+
 	QUIET_FLEX     = @echo '   ' FLEX $@;
 	QUIET_BISON    = @echo '   ' BISON $@;
 endif
-- 
1.7.9.3.362.g71319


-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-12 15:22       ` Borislav Petkov
@ 2012-04-12 15:57         ` Sam Ravnborg
  2012-04-12 18:33           ` Arnaldo Carvalho de Melo
  2012-04-13 10:45           ` Borislav Petkov
  0 siblings, 2 replies; 25+ messages in thread
From: Sam Ravnborg @ 2012-04-12 15:57 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Michal Marek, LKML

> --
> 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-12 15:57         ` Sam Ravnborg
@ 2012-04-12 18:33           ` Arnaldo Carvalho de Melo
  2012-04-12 19:16             ` Sam Ravnborg
  2012-04-12 21:17             ` Alex Riesen
  2012-04-13 10:45           ` Borislav Petkov
  1 sibling, 2 replies; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-12 18:33 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Borislav Petkov, Ingo Molnar, Michal Marek, LKML

Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:
> > 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...

Came from the git sources, where it still lives on:

[acme@sandy git]$ git show b7774343
commit b777434383bd2f365be6896d8c89be6c1b62a135
Author: Alex Riesen <raa.lkml@gmail.com>
Date:   Wed Mar 7 00:44:49 2007 +0100

    Support of "make -s": do not output anything of the build itself
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>

- Arnaldo

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  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
  1 sibling, 1 reply; 25+ messages in thread
From: Sam Ravnborg @ 2012-04-12 19:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Borislav Petkov, Ingo Molnar, Michal Marek, LKML

On Thu, Apr 12, 2012 at 03:33:51PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:
> > > 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...
> 
> Came from the git sources, where it still lives on:
> 
> [acme@sandy git]$ git show b7774343
> commit b777434383bd2f365be6896d8c89be6c1b62a135
> Author: Alex Riesen <raa.lkml@gmail.com>
> Date:   Wed Mar 7 00:44:49 2007 +0100
> 
>     Support of "make -s": do not output anything of the build itself
>     
>     Signed-off-by: Junio C Hamano <junkio@cox.net>

Part of the git build infrastructure has not impressed me - others parts are good.
But then it is more than a year since I actually looked at it.

And no - I have no time left to actually do anything about it.

	Sam

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-12 19:16             ` Sam Ravnborg
@ 2012-04-12 19:31               ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-12 19:31 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Borislav Petkov, Ingo Molnar, Michal Marek, LKML

Em Thu, Apr 12, 2012 at 09:16:11PM +0200, Sam Ravnborg escreveu:
> On Thu, Apr 12, 2012 at 03:33:51PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:
> > > Who-ever came up with the names "QUIET_SUBDIR" must have had a bad day...

> > Came from the git sources, where it still lives on:

> > [acme@sandy git]$ git show b7774343
> > commit b777434383bd2f365be6896d8c89be6c1b62a135
> > Author: Alex Riesen <raa.lkml@gmail.com>
> > Date:   Wed Mar 7 00:44:49 2007 +0100
> >     Support of "make -s": do not output anything of the build itself
> >     Signed-off-by: Junio C Hamano <junkio@cox.net>

> Part of the git build infrastructure has not impressed me - others parts are good.
> But then it is more than a year since I actually looked at it.
> 
> And no - I have no time left to actually do anything about it.

Neither me, similar impressions, for the Makefiles, I really want us to
move to what is used by our landlord, the kernel :-)

I also can see doing a 'make tools/menuconfig' to select what we want to
build in a particular perf build, for instance, I received requests for
building just 'perf record' to use it in embedded systems, collect your
events, push it to another machine, where one would use a full featured
perf build.

Or one without perl, if one hates that thing :-)

- Arnaldo

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-12 18:33           ` Arnaldo Carvalho de Melo
  2012-04-12 19:16             ` Sam Ravnborg
@ 2012-04-12 21:17             ` Alex Riesen
  1 sibling, 0 replies; 25+ messages in thread
From: Alex Riesen @ 2012-04-12 21:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Sam Ravnborg, Borislav Petkov, Ingo Molnar, Michal Marek, LKML

On Thu, Apr 12, 2012 at 20:33, Arnaldo Carvalho de Melo
<acme@infradead.org> wrote:
> Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:
>> >
>> > -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...
>
> Came from the git sources, where it still lives on:
>
> [acme@sandy git]$ git show b7774343
> commit b777434383bd2f365be6896d8c89be6c1b62a135
> Author: Alex Riesen <raa.lkml@gmail.com>
> Date:   Wed Mar 7 00:44:49 2007 +0100
>
>    Support of "make -s": do not output anything of the build itself
>
>    Signed-off-by: Junio C Hamano <junkio@cox.net>
>

Looked like a good idea at the time.

http://www.merriam-webster.com/dictionary/quiet

  qui·et
  verb \ˈkwī-ət\

  Definition of QUIET
  transitive verb
  1: to cause to be quiet : calm

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 5/5] tools: Connect to the kernel build system
  2012-04-12 15:57         ` Sam Ravnborg
  2012-04-12 18:33           ` Arnaldo Carvalho de Melo
@ 2012-04-13 10:45           ` Borislav Petkov
  1 sibling, 0 replies; 25+ messages in thread
From: Borislav Petkov @ 2012-04-13 10:45 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Ingo Molnar,
	Michal Marek, LKML

On Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg wrote:
> >  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.

This has the side effect of starting a sub-make in that output directory
and trying to build the kernel i.e. I'm looking at the code around
"ifneq ($(KBUILD_OUTPUT),)":

$ make O=/tmp/pbuild tools/perf
  HOSTCC  scripts/basic/fixdep
  GEN     /tmp/pbuild/Makefile
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[3]: *** [silentoldconfig] Error 1
make[2]: *** [silentoldconfig] Error 2
    SUBDIR perf/

but then descends into tools/perf/

...

I haven't looked at the branch where KBUILD_OUTPUT is not empty yet,
maybe there we could do something...

> >  # 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...

Right, so this could probably reuse the quiet_cmd_* machinery from the
toplevel Makefile now...

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [tip:perf/core] tools: Add Makefile.include
  2012-04-11 16:36 ` [PATCH v5 1/5] tools: Add Makefile.include Borislav Petkov
@ 2012-04-13 18:14   ` tip-bot for Borislav Petkov
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Borislav Petkov @ 2012-04-13 18:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, sam, mmarek, tglx, borislav.petkov

Commit-ID:  98d89bfd0d4b2f218ec709e90ddcab6d82d7671e
Gitweb:     http://git.kernel.org/tip/98d89bfd0d4b2f218ec709e90ddcab6d82d7671e
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Wed, 11 Apr 2012 18:36:14 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 Apr 2012 14:57:36 -0300

tools: Add Makefile.include

Put generic enough build settings which could be reused by other tools
into a common Makefile.include file.

This commit reintroduces QUIET_SUBDIR{0,1} (see a3d1ee10d1bf) which are
going to be used in the following patches.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: http://lkml.kernel.org/r/1334162178-17152-2-git-send-email-bp@amd64.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile            |   47 +--------------------------------
 tools/scripts/Makefile.include |   57 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 46 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 820371f..4ca77cc 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -1,18 +1,10 @@
-ifeq ("$(origin O)", "command line")
-	OUTPUT := $(O)/
-endif
+include ../scripts/Makefile.include
 
 # The default target of this Makefile is...
 all:
 
 include config/utilities.mak
 
-ifneq ($(OUTPUT),)
-# check that the output directory actually exists
-OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
-$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
-endif
-
 # Define V to have a more verbose compile.
 #
 # Define O to save output files in a separate directory.
@@ -84,31 +76,6 @@ ifneq ($(WERROR),0)
 	CFLAGS_WERROR := -Werror
 endif
 
-#
-# Include saner warnings here, which can catch bugs:
-#
-
-EXTRA_WARNINGS := -Wformat
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
-
 ifeq ("$(origin DEBUG)", "command line")
   PERF_DEBUG = $(DEBUG)
 endif
@@ -679,18 +646,6 @@ else
 	endif
 endif
 
-ifneq ($(findstring $(MAKEFLAGS),s),s)
-ifndef V
-	QUIET_CC       = @echo '   ' CC $@;
-	QUIET_AR       = @echo '   ' AR $@;
-	QUIET_LINK     = @echo '   ' LINK $@;
-	QUIET_MKDIR    = @echo '   ' MKDIR $@;
-	QUIET_GEN      = @echo '   ' GEN $@;
-	QUIET_FLEX     = @echo '   ' FLEX $@;
-	QUIET_BISON    = @echo '   ' BISON $@;
-endif
-endif
-
 ifdef ASCIIDOC8
 	export ASCIIDOC8
 endif
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
new file mode 100644
index 0000000..52348d3
--- /dev/null
+++ b/tools/scripts/Makefile.include
@@ -0,0 +1,57 @@
+ifeq ("$(origin O)", "command line")
+	OUTPUT := $(O)/
+endif
+
+ifneq ($(OUTPUT),)
+# check that the output directory actually exists
+OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
+$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
+endif
+
+#
+# Include saner warnings here, which can catch bugs:
+#
+EXTRA_WARNINGS := -Wformat
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
+
+ifneq ($(findstring $(MAKEFLAGS), w),w)
+PRINT_DIR = --no-print-directory
+else
+NO_SUBDIR = :
+endif
+
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+	QUIET_CC       = @echo '   ' CC $@;
+	QUIET_AR       = @echo '   ' AR $@;
+	QUIET_LINK     = @echo '   ' LINK $@;
+	QUIET_MKDIR    = @echo '   ' MKDIR $@;
+	QUIET_GEN      = @echo '   ' GEN $@;
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+	QUIET_FLEX     = @echo '   ' FLEX $@;
+	QUIET_BISON    = @echo '   ' BISON $@;
+endif
+endif

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [tip:perf/core] tools: Cleanup EXTRA_WARNINGS
  2012-04-11 16:36 ` [PATCH v5 2/5] tools: Cleanup EXTRA_WARNINGS Borislav Petkov
@ 2012-04-13 18:15   ` tip-bot for Borislav Petkov
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Borislav Petkov @ 2012-04-13 18:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, sam, mmarek, tglx, borislav.petkov

Commit-ID:  d8caf3eb240f4b3100cd8e4f0178df9801bce537
Gitweb:     http://git.kernel.org/tip/d8caf3eb240f4b3100cd8e4f0178df9801bce537
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Wed, 11 Apr 2012 18:36:15 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 Apr 2012 14:57:50 -0300

tools: Cleanup EXTRA_WARNINGS

Use += instead of the bash syntax, as Sam Ravnborg suggests. Also, sort
the -W options alphabetically and (... keep them sorted).

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: http://lkml.kernel.org/r/1334162178-17152-3-git-send-email-bp@amd64.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/scripts/Makefile.include |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 52348d3..87b55a7 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -11,26 +11,26 @@ endif
 #
 # Include saner warnings here, which can catch bugs:
 #
-EXTRA_WARNINGS := -Wformat
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
+EXTRA_WARNINGS := -Wbad-function-cast
+EXTRA_WARNINGS += -Wdeclaration-after-statement
+EXTRA_WARNINGS += -Wformat-security
+EXTRA_WARNINGS += -Wformat-y2k
+EXTRA_WARNINGS += -Winit-self
+EXTRA_WARNINGS += -Wmissing-declarations
+EXTRA_WARNINGS += -Wmissing-prototypes
+EXTRA_WARNINGS += -Wnested-externs
+EXTRA_WARNINGS += -Wno-system-headers
+EXTRA_WARNINGS += -Wold-style-definition
+EXTRA_WARNINGS += -Wpacked
+EXTRA_WARNINGS += -Wredundant-decls
+EXTRA_WARNINGS += -Wshadow
+EXTRA_WARNINGS += -Wstrict-aliasing=3
+EXTRA_WARNINGS += -Wstrict-prototypes
+EXTRA_WARNINGS += -Wswitch-default
+EXTRA_WARNINGS += -Wswitch-enum
+EXTRA_WARNINGS += -Wundef
+EXTRA_WARNINGS += -Wwrite-strings
+EXTRA_WARNINGS += -Wformat
 
 ifneq ($(findstring $(MAKEFLAGS), w),w)
 PRINT_DIR = --no-print-directory

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [tip:perf/core] tools: Add a toplevel Makefile
  2012-04-11 16:36 ` [PATCH v5 3/5] tools: Add a toplevel Makefile Borislav Petkov
@ 2012-04-13 18:16   ` tip-bot for Borislav Petkov
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Borislav Petkov @ 2012-04-13 18:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, sam, mmarek, tglx, borislav.petkov

Commit-ID:  2363ecb17041d711fa2b3fb1b1ea2ebc47a0f974
Gitweb:     http://git.kernel.org/tip/2363ecb17041d711fa2b3fb1b1ea2ebc47a0f974
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Wed, 11 Apr 2012 18:36:16 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 Apr 2012 14:58:43 -0300

tools: Add a toplevel Makefile

Add a Makefile with all the targets under tools/.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: http://lkml.kernel.org/r/1334162178-17152-4-git-send-email-bp@amd64.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/Makefile |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644
index 0000000..feadfdd
--- /dev/null
+++ b/tools/Makefile
@@ -0,0 +1,47 @@
+include scripts/Makefile.include
+
+cpupower: FORCE
+	$(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1)
+
+firewire lguest perf usb virtio vm: FORCE
+	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
+
+selftests: FORCE
+	$(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1)
+
+turbostat x86_energy_perf_policy: FORCE
+	$(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1)
+
+cpupower_install:
+	$(QUIET_SUBDIR0)power/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+firewire_install lguest_install perf_install usb_install virtio_install vm_install:
+	$(QUIET_SUBDIR0)$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+selftests_install:
+	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) install
+
+turbostat_install x86_energy_perf_policy_install:
+	$(QUIET_SUBDIR0)power/x86/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+install: cpupower_install firewire_install lguest_install perf_install \
+		selftests_install turbostat_install usb_install virtio_install \
+		vm_install x86_energy_perf_policy_install
+
+cpupower_clean:
+	$(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean
+
+firewire_clean lguest_clean perf_clean usb_clean virtio_clean vm_clean:
+	$(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+selftests_clean:
+	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+turbostat_clean x86_energy_perf_policy_clean:
+	$(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+clean: cpupower_clean firewire_clean lguest_clean perf_clean selftests_clean \
+		turbostat_clean usb_clean virtio_clean vm_clean \
+		x86_energy_perf_policy_clean
+
+.PHONY: FORCE

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [tip:perf/core] tools: Add a help target
  2012-04-11 16:36 ` [PATCH v5 4/5] tools: Add a help target Borislav Petkov
@ 2012-04-13 18:17   ` tip-bot for Borislav Petkov
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Borislav Petkov @ 2012-04-13 18:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, sam, mmarek, tglx, borislav.petkov

Commit-ID:  d5dd8afb569cdf89bd2b322d10f80a23bd3d2cfd
Gitweb:     http://git.kernel.org/tip/d5dd8afb569cdf89bd2b322d10f80a23bd3d2cfd
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Wed, 11 Apr 2012 18:36:17 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 Apr 2012 14:59:00 -0300

tools: Add a help target

... and make it the default one so that calling 'make' without arguments
in the tools/ directory gives you the possible targets to build along
with a short description of what they are.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: http://lkml.kernel.org/r/1334162178-17152-5-git-send-email-bp@amd64.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/Makefile |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index feadfdd..f87c0ec 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,5 +1,25 @@
 include scripts/Makefile.include
 
+help:
+	@echo 'Possible targets:'
+	@echo ''
+	@echo '  cpupower   - a tool for all things x86 CPU power'
+	@echo '  firewire   - the userspace part of nosy, an IEEE-1394 traffic sniffer'
+	@echo '  lguest     - a minimal 32-bit x86 hypervisor'
+	@echo '  perf       - Linux performance measurement and analysis tool'
+	@echo '  selftests  - various kernel selftests'
+	@echo '  turbostat  - Intel CPU idle stats and freq reporting tool'
+	@echo '  usb        - USB testing tools'
+	@echo '  virtio     - vhost test module'
+	@echo '  vm         - misc vm tools'
+	@echo '  x86_energy_perf_policy - Intel energy policy tool'
+	@echo ''
+	@echo 'Cleaning targets:'
+	@echo ''
+	@echo '  all of the above with the "_clean" string appended cleans'
+	@echo '    the respective build directory.'
+	@echo '  clean: a summary clean target to clean _all_ folders'
+
 cpupower: FORCE
 	$(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1)
 

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [tip:perf/core] tools: Connect to the kernel build system
  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-13 18:18   ` tip-bot for Borislav Petkov
  2012-04-14  6:35     ` Alex Riesen
  1 sibling, 1 reply; 25+ messages in thread
From: tip-bot for Borislav Petkov @ 2012-04-13 18:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, mingo, sam, mmarek, tglx, borislav.petkov

Commit-ID:  ea01fa9f63aeff3ac918868217aa94adf76ddcc7
Gitweb:     http://git.kernel.org/tip/ea01fa9f63aeff3ac918868217aa94adf76ddcc7
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Wed, 11 Apr 2012 18:36:18 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 Apr 2012 15:00:17 -0300

tools: Connect to the kernel build system

Now you can do

$ make tools/<toolname>

from the toplevel kernel directory and have the respective tool built.

If you want to build and install it, do

$ make tools/<toolname>_install

$ make tools/<toolname>_clean

should clean the respective tool directories.

If you want to clean all in tools, simply do

$ make tools/clean

Also, if you want to get what the possible targets are, simply calling

$ make tools/

should give you the short help.

$ make tools/install

installs all tools, of course. Doh.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: http://lkml.kernel.org/r/1334162178-17152-6-git-send-email-bp@amd64.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 Makefile       |    7 +++++++
 tools/Makefile |   10 ++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 1932984..23b9ce5 100644
--- a/Makefile
+++ b/Makefile
@@ -1468,6 +1468,13 @@ kernelrelease:
 kernelversion:
 	@echo $(KERNELVERSION)
 
+# Clear a bunch of variables before executing the submake
+tools/: FORCE
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/
+
+tools/%: FORCE
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
+
 # Single targets
 # ---------------------------------------------------------------------------
 # Single targets are compatible with:
diff --git a/tools/Makefile b/tools/Makefile
index f87c0ec..3ae4394 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -14,6 +14,16 @@ help:
 	@echo '  vm         - misc vm tools'
 	@echo '  x86_energy_perf_policy - Intel energy policy tool'
 	@echo ''
+	@echo 'You can do:'
+	@echo ' $$ make -C tools/<tool>_install'
+	@echo ''
+	@echo '  from the kernel command line to build and install one of'
+	@echo '  the tools above'
+	@echo ''
+	@echo '  $$ make tools/install'
+	@echo ''
+	@echo '  installs all tools.'
+	@echo ''
 	@echo 'Cleaning targets:'
 	@echo ''
 	@echo '  all of the above with the "_clean" string appended cleans'

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [tip:perf/core] tools: Connect to the kernel build system
  2012-04-13 18:18   ` [tip:perf/core] " tip-bot for Borislav Petkov
@ 2012-04-14  6:35     ` Alex Riesen
  0 siblings, 0 replies; 25+ messages in thread
From: Alex Riesen @ 2012-04-14  6:35 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, acme, sam, tglx, mmarek, borislav.petkov
  Cc: linux-tip-commits

On Fri, Apr 13, 2012 at 20:18, tip-bot for Borislav Petkov
<borislav.petkov@amd.com> wrote:
> Also, if you want to get what the possible targets are, simply calling
>
> $ make tools/
>
> should give you the short help.

Is "make tools" (without trailing slash) reserved for something?
If not, it might make sense to allow it also (to mean "make tools/").

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-04-14  6:35 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.