Skip to contentSkip to conversation

tools: Add a toplevel Makefile

PATCH In review Borislav Petkov 6 participants 25 messages Apr 11, 2012 – Apr 14, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 cover tools: Add a toplevel Makefile

From: Borislav Petkov <[email protected]>

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.

#1 lore raw

PATCH v5 1/5 tools: Add Makefile.include

From: Borislav Petkov <[email protected]>

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.

---
 tools/perf/Makefile            |   47 +--------------------------------
 tools/scripts/Makefile.include |   57 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 46 deletions(-)
 create mode 100644 tools/scripts/Makefile.include
tools/perf/Makefile +1 -46
index 820371f10d1b..4ca77cc0f284 100644
@@ -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
tools/scripts/Makefile.include new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.7.9.3.362.g71319
#2 lore raw

[tip:perf/core] tools: Add Makefile.include

Commit-ID:  98d89bfd0d4b2f218ec709e90ddcab6d82d7671e
Gitweb:     http://git.kernel.org/tip/98d89bfd0d4b2f218ec709e90ddcab6d82d7671e
Author:     Borislav Petkov <[email protected]>
AuthorDate: Wed, 11 Apr 2012 18:36:14 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 tools/perf/Makefile            |   47 +--------------------------------
 tools/scripts/Makefile.include |   57 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 46 deletions(-)
tools/perf/Makefile +1 -46
index 820371f..4ca77cc 100644
@@ -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
tools/scripts/Makefile.include new file +57 -0

57 lines not on this page · raw message

#3 lore raw

PATCH v5 2/5 tools: Cleanup EXTRA_WARNINGS

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

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

---
 tools/scripts/Makefile.include |   40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
tools/scripts/Makefile.include +20 -20
index 52348d3bd8d3..87b55a729a5f 100644
@@ -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
Signature · 1 line
1.7.9.3.362.g71319
#4 lore raw

[tip:perf/core] tools: Cleanup EXTRA_WARNINGS

Commit-ID:  d8caf3eb240f4b3100cd8e4f0178df9801bce537
Gitweb:     http://git.kernel.org/tip/d8caf3eb240f4b3100cd8e4f0178df9801bce537
Author:     Borislav Petkov <[email protected]>
AuthorDate: Wed, 11 Apr 2012 18:36:15 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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).

---
 tools/scripts/Makefile.include |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)
tools/scripts/Makefile.include +20 -20
index 52348d3..87b55a7 100644
@@ -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
#5 lore raw

PATCH v5 3/5 tools: Add a toplevel Makefile

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Add a Makefile with all the targets under tools/.

---
 tools/Makefile |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 tools/Makefile
tools/Makefile new file +47 -0
new file mode 100644
index 000000000000..feadfdd6da55
@@ -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
Signature · 1 line
1.7.9.3.362.g71319
#6 lore raw
Commit-ID:  2363ecb17041d711fa2b3fb1b1ea2ebc47a0f974
Gitweb:     http://git.kernel.org/tip/2363ecb17041d711fa2b3fb1b1ea2ebc47a0f974
Author:     Borislav Petkov <[email protected]>
AuthorDate: Wed, 11 Apr 2012 18:36:16 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 11 Apr 2012 14:58:43 -0300

tools: Add a toplevel Makefile

Add a Makefile with all the targets under tools/.

---
 tools/Makefile |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
tools/Makefile new file +47 -0
new file mode 100644
index 0000000..feadfdd
@@ -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
#7 lore raw

PATCH v5 4/5 tools: Add a help target

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

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

---
 tools/Makefile |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
tools/Makefile +20 -0
index feadfdd6da55..f87c0ec63e6c 100644
@@ -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)
 
Signature · 1 line
1.7.9.3.362.g71319
#8 lore raw

[tip:perf/core] tools: Add a help target

Commit-ID:  d5dd8afb569cdf89bd2b322d10f80a23bd3d2cfd
Gitweb:     http://git.kernel.org/tip/d5dd8afb569cdf89bd2b322d10f80a23bd3d2cfd
Author:     Borislav Petkov <[email protected]>
AuthorDate: Wed, 11 Apr 2012 18:36:17 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 tools/Makefile |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
tools/Makefile +20 -0
index feadfdd..f87c0ec 100644
@@ -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)
 
#9 lore raw

PATCH v5 5/5 tools: Connect to the kernel build system

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

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.

---
 Makefile       |    7 +++++++
 tools/Makefile |   10 ++++++++++
 2 files changed, 17 insertions(+)
Makefile +7 -0
index 0df3d003a079..f7f738117128 100644
@@ -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:
tools/Makefile +10 -0
index f87c0ec63e6c..3ae43947a171 100644
@@ -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'
Signature · 1 line
1.7.9.3.362.g71319
#10 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:

Quoted 11 lines

From: Borislav Petkov <[email protected]>

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

Quoted 66 lines
$ 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.

---
 Makefile       |    7 +++++++
 tools/Makefile |   10 ++++++++++
 2 files changed, 17 insertions(+)
Makefile +7 -0
index 0df3d003a079..f7f738117128 100644
@@ -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:
tools/Makefile +10 -0
index f87c0ec63e6c..3ae43947a171 100644
@@ -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'
Signature · 1 line
1.7.9.3.362.g71319
#11 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Em Wed, Apr 11, 2012 at 03:04:34PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 13 lines

Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:

Quoted 11 lines

From: Borislav Petkov <[email protected]>

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

[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

Quoted 68 lines

- Arnaldo

Quoted 66 lines
$ 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.

---
 Makefile       |    7 +++++++
 tools/Makefile |   10 ++++++++++
 2 files changed, 17 insertions(+)
Makefile +7 -0
index 0df3d003a079..f7f738117128 100644
@@ -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:
tools/Makefile +10 -0
index f87c0ec63e6c..3ae43947a171 100644
@@ -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'
Signature · 1 line
1.7.9.3.362.g71319
#12 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 6 lines

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

Quoted 7 lines
Quoted 1 line

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

#13 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Quoted 6 lines · David Ahern

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
Signature · 8 lines
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
#14 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

In reply to David Ahern

Em Wed, Apr 11, 2012 at 12:19:15PM -0600, David Ahern escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 13 lines
Quoted 8 lines

[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

Quoted 8 lines
Quoted 1 line

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

#15 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

In reply to Arnaldo Carvalho de Melo
Quoted 18 lines · Arnaldo Carvalho de Melo

Em Wed, Apr 11, 2012 at 03:04:34PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 17 lines

Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:

Quoted 11 lines

From: Borislav Petkov <[email protected]>

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

Quoted 5 lines
Quoted 3 lines

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 <[email protected]>
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.

---
 Makefile                       |    9 +++++++--
 tools/scripts/Makefile.include |   18 +++++++++++++++---
 2 files changed, 22 insertions(+), 5 deletions(-)
Makefile +7 -2
index 23b9ce5a2c2c..2cb2ee2dc6ae 100644
@@ -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
 # ---------------------------------------------------------------------------
tools/scripts/Makefile.include +15 -3
index 87b55a729a5f..297b51d8e4be 100644
@@ -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
Signature · 12 lines
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
#16 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Quoted 24 lines

--
From: Borislav Petkov <[email protected]>
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.

---
 Makefile                       |    9 +++++++--
 tools/scripts/Makefile.include |   18 +++++++++++++++---
 2 files changed, 22 insertions(+), 5 deletions(-)
Makefile +0 -0
index 23b9ce5a2c2c..2cb2ee2dc6ae 100644
@@ -98,8 +98,13 @@ ifeq ($(KBUILD_SRC),)
 
 # OK, Make called in directory where kernel src resides

Makefile ifeq ($(KBUILD_SRC),) · line 108

Quoted 10 lines
Makefile +6 -1
 # 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...

Makefile tools/: FORCE · line 1481

Quoted 8 lines
Makefile +1 -1
 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:

Makefile tools/: FORCE · line 1482

Quoted 1 line
Makefile +1 -0
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(KBUILD_OUTPUT) -C $(src)/tools/ $*

And then avoid the hacks above.

tools/scripts/Makefile.include else · line 42

Quoted 13 lines
Makefile +0 -0
 # Single targets
 # ---------------------------------------------------------------------------
tools/scripts/Makefile.include +0 -2
index 87b55a729a5f..297b51d8e4be 100644
@@ -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

#17 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:

Quoted 8 lines
Quoted 8 lines
tools/scripts/Makefile.include +0 -0
index 87b55a729a5f..297b51d8e4be 100644
@@ -38,11 +38,18 @@ else
 NO_SUBDIR = :
 endif
 
Quoted 4 lines

tools/scripts/Makefile.include else · line 42

Quoted 2 lines
tools/scripts/Makefile.include +0 -2
-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 <[email protected]>
Date:   Wed Mar 7 00:44:49 2007 +0100

Support of "make -s": do not output anything of the build itself

- Arnaldo

#18 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Quoted 16 lines · Arnaldo Carvalho de Melo

Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:

Quoted 8 lines
Quoted 8 lines
tools/scripts/Makefile.include +0 -0
index 87b55a729a5f..297b51d8e4be 100644
@@ -38,11 +38,18 @@ else
 NO_SUBDIR = :
 endif
 
Quoted 4 lines

tools/scripts/Makefile.include else · line 42

Quoted 2 lines
tools/scripts/Makefile.include +0 -2
-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:

Quoted 8 lines

[acme@sandy git]$ git show b7774343
commit b777434383bd2f365be6896d8c89be6c1b62a135

Author: Alex Riesen <[email protected]>
Date:   Wed Mar 7 00:44:49 2007 +0100

Support of "make -s": do not output anything of the build itself

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

#19 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

Em Thu, Apr 12, 2012 at 09:16:11PM +0200, Sam Ravnborg escreveu:

Quoted 13 lines · Arnaldo Carvalho de Melo
Quoted 11 lines

Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:

Quoted 1 line

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 <[email protected]>
Date:   Wed Mar 7 00:44:49 2007 +0100

Support of "make -s": do not output anything of the build itself

Quoted 4 lines

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

#20 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

In reply to Arnaldo Carvalho de Melo
Quoted 9 lines · Arnaldo Carvalho de Melo

Em Thu, Apr 12, 2012 at 05:57:34PM +0200, Sam Ravnborg escreveu:

Quoted 5 lines

tools/scripts/Makefile.include else · line 42

Quoted 3 lines
tools/scripts/Makefile.include +0 -2
-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:

Quoted 9 lines

[acme@sandy git]$ git show b7774343
commit b777434383bd2f365be6896d8c89be6c1b62a135
Author: Alex Riesen <[email protected]>
Date:   Wed Mar 7 00:44:49 2007 +0100

   Support of "make -s": do not output anything of the build itself

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

#21 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

In reply to Sam Ravnborg
Quoted 11 lines · Sam Ravnborg

Makefile tools/: FORCE · line 1481

Quoted 7 lines

ifeq ("$(origin W)", "command line")

Makefile +1 -1
@@ -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:

Review tools/: FORCE · line 1482

Quoted 1 line
(quoted diff) +1 -0
+	$(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...

Quoted 16 lines

tools/scripts/Makefile.include else · line 42

Quoted 12 lines
Makefile +0 -0
 # Single targets
 # ---------------------------------------------------------------------------
tools/scripts/Makefile.include +0 -2
index 87b55a729a5f..297b51d8e4be 100644
@@ -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:

Quoted 8 lines

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

Signature · 8 lines
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
#22 lore raw

Re: [PATCH v5 5/5] tools: Connect to the kernel build system

In reply to Arnaldo Carvalho de Melo
Quoted 13 lines · Arnaldo Carvalho de Melo

Em Wed, Apr 11, 2012 at 06:36:18PM +0200, Borislav Petkov escreveu:

Quoted 11 lines

From: Borislav Petkov <[email protected]>

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

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

Signature · 8 lines
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
#23 lore raw

[tip:perf/core] tools: Connect to the kernel build system

In reply to Borislav Petkov
Commit-ID:  ea01fa9f63aeff3ac918868217aa94adf76ddcc7
Gitweb:     http://git.kernel.org/tip/ea01fa9f63aeff3ac918868217aa94adf76ddcc7
Author:     Borislav Petkov <[email protected]>
AuthorDate: Wed, 11 Apr 2012 18:36:18 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 Makefile       |    7 +++++++
 tools/Makefile |   10 ++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
Makefile +7 -0
index 1932984..23b9ce5 100644
@@ -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:
tools/Makefile +10 -0
index f87c0ec..3ae4394 100644
@@ -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'
#24 lore raw

Re: [tip:perf/core] tools: Connect to the kernel build system

Quoted 5 lines · tip-bot for Borislav Petkov

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/").