Skip to contentSkip to conversation

tools: Add a toplevel Makefile

PATCH Superseded Borislav Petkov 2 participants 12 messages Apr 10, 2012

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover tools: Add a toplevel Makefile

From: Borislav Petkov <[email protected]>

Hi all,

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.

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

* 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 v4 1/4 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

Re: [PATCH v4 1/4] tools: Add Makefile.include

Hi Borislav.

Some random comments as I really did not look at this part of the patch-set before.

tools/scripts/Makefile.include line 15

Quoted 5 lines
tools/scripts/Makefile.include new file +5 -0
+#
+# Include saner warnings here, which can catch bugs:
+#
+EXTRA_WARNINGS := -Wformat
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security

Two general comments - and I know this is just something you copied... Why not use the += operator. The below looks like shell script syntax. And we use the += operator in other places - at least in the kernel stuff.

AND WHY ALL THESE SCREAMING CAPITAL LETTERS?
I know Makefiles and scripts are full of them - but that does not help the readability.

For kbuild I generally shifted to use:
- lower-case names for local stuff
- Upper case letters for global stuff - properly prefixed to avoid collisions EXTRA_WARNINGS likely fall into the category global-stuff,
but then a local variable could still be usefull.

Sam

#3 lore raw

Re: [PATCH v4 1/4] tools: Add Makefile.include

Quoted 4 lines · Sam Ravnborg

Hi Borislav.

Some random comments as I really did not look at this part of the patch-set before.

.. and I appreciate those, thanks.

Quoted 7 lines

tools/scripts/Makefile.include line 15

Quoted 5 lines
tools/scripts/Makefile.include new file +5 -0
+#
+# Include saner warnings here, which can catch bugs:
+#
+EXTRA_WARNINGS := -Wformat
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security

Two general comments - and I know this is just something you copied...

Yep, I did from perf's Makefile.

Quoted 2 lines

Why not use the += operator. The below looks like shell script syntax. And we use the += operator in other places - at least in the kernel stuff.

Yep, this makes this assignment monster a bit more readable, sure.

Quoted 9 lines

AND WHY ALL THESE SCREAMING CAPITAL LETTERS?
I know Makefiles and scripts are full of them - but that does not help the readability.

For kbuild I generally shifted to use:
- lower-case names for local stuff
- Upper case letters for global stuff - properly prefixed to avoid collisions EXTRA_WARNINGS likely fall into the category global-stuff,
but then a local variable could still be usefull.

Well, my intention was to have EXTRA_WARNINGS be a global variable which all tools under tools/ could start using so that we can benefit from the compiler doing some more extensive checking. Thus all caps, no?

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
#4 lore raw

PATCH v4 2/4 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 |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 tools/Makefile
tools/Makefile new file +31 -0
new file mode 100644
index 000000000000..e93b8ec3d250
@@ -0,0 +1,31 @@
+include scripts/Makefile.include
+
+perf firewire lguest usb virtio vm: FORCE
+	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
+
+cpupower: FORCE
+	$(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1)
+
+turbostat x86_energy_perf_policy: FORCE
+	$(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1)
+
+selftests: FORCE
+	$(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1)
+
+firewire_clean lguest_clean perf_clean vm_clean usb_clean virtio_clean:
+	$(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+cp_clean:
+	$(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean
+
+turbostat_clean x86_energy_perf_policy_clean:
+	$(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+selftests_clean:
+	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+clean: cp_clean firewire_clean lguest_clean perf_clean selftests_clean \
+		turbostat_clean usb_clean virtio_clean \
+		x86_energy_perf_policy_clean
+
+.PHONY: FORCE
Signature · 1 line
1.7.9.3.362.g71319
#5 lore raw
Quoted 37 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

Add a Makefile with all the targets under tools/.

---
 tools/Makefile |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 tools/Makefile
tools/Makefile new file +21 -0
new file mode 100644
index 000000000000..e93b8ec3d250
@@ -0,0 +1,31 @@
+include scripts/Makefile.include
+
+perf firewire lguest usb virtio vm: FORCE
+	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
+
+cpupower: FORCE
+	$(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1)
+
+turbostat x86_energy_perf_policy: FORCE
+	$(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1)
+
+selftests: FORCE
+	$(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1)
+
+firewire_clean lguest_clean perf_clean vm_clean usb_clean virtio_clean:
+	$(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+cp_clean:
+	$(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean
+
+turbostat_clean x86_energy_perf_policy_clean:

tools/Makefile line 31

Quoted 10 lines
tools/Makefile new file +10 -0
+	$(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+selftests_clean:
+	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
+
+clean: cp_clean firewire_clean lguest_clean perf_clean selftests_clean \
+		turbostat_clean usb_clean virtio_clean \
+		x86_energy_perf_policy_clean
+
+.PHONY: FORCE

Things would be much simpler is all tools were adjusted to:
a) the subdir they live in is the make target name
b) each tool has three mandatory targets:
1) default target => build the tool
2) clean
3) install

I can see that with the layout today you cannot distingush between the various targets below power. But the current solutions is not scaleable nor maintainable.

Even if you cannot fix power/* then testing looks easy.

But all that can always to improved and consolidated later.

Sam

#6 lore raw
Quoted 7 lines · Sam Ravnborg

Things would be much simpler is all tools were adjusted to:
a) the subdir they live in is the make target name
b) each tool has three mandatory targets:
1) default target => build the tool
2) clean
3) install

Quoted 7 lines

I can see that with the layout today you cannot distingush between the various targets below power. But the current solutions is not scaleable nor maintainable.

Even if you cannot fix power/* then testing looks easy.

But all that can always to improved and consolidated later.

Right, I was deliberating on whether to unify the dir layout so that it fits with the Makefile targets nicely but decided to leave it out for later. IOW, do the "one thing at a time" deal. Besides, some tools don't have that clearly defined targets and selftests, for example, doesn't need to be installed but simply run in a loop.

So definitely agreed, the tools/ dir could use a bunch of cultivating in later cycles.

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
#7 lore raw

PATCH v4 3/4 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 |   26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
tools/Makefile +23 -3
index e93b8ec3d250..c7ed814e12cf 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'
+
 perf firewire lguest usb virtio vm: FORCE
 	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
 
@@ -15,7 +35,7 @@ selftests: FORCE
 firewire_clean lguest_clean perf_clean vm_clean usb_clean virtio_clean:
 	$(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean
 
-cp_clean:
+cpupower_clean:
 	$(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean
 
 turbostat_clean x86_energy_perf_policy_clean:
@@ -24,8 +44,8 @@ turbostat_clean x86_energy_perf_policy_clean:
 selftests_clean:
 	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
 
-clean: cp_clean firewire_clean lguest_clean perf_clean selftests_clean \
-		turbostat_clean usb_clean virtio_clean \
+clean: cpupower_clean firewire_clean lguest_clean perf_clean \
+		selftests_clean turbostat_clean usb_clean virtio_clean \
 		x86_energy_perf_policy_clean
 
 .PHONY: FORCE
Signature · 1 line
1.7.9.3.362.g71319
#8 lore raw

Re: [PATCH v4 3/4] tools: Add a help target

Quoted 42 lines · 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 |   26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
tools/Makefile +20 -0
index e93b8ec3d250..c7ed814e12cf 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'
+
 perf firewire lguest usb virtio vm: FORCE
 	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
 

tools/Makefile selftests: FORCE · line 39

Quoted 6 lines
tools/Makefile +1 -1
@@ -15,7 +35,7 @@ selftests: FORCE
 firewire_clean lguest_clean perf_clean vm_clean usb_clean virtio_clean:
 	$(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean
 
-cp_clean:
+cpupower_clean:
 	$(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean

Fold this into 2/4

tools/Makefile turbostat_clean x86_energy_perf_policy_clean: · line 49

Quoted 11 lines
tools/Makefile +2 -2
 turbostat_clean x86_energy_perf_policy_clean:
@@ -24,8 +44,8 @@ turbostat_clean x86_energy_perf_policy_clean:
 selftests_clean:
 	$(QUIET_SUBDIR0)testing/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
 
-clean: cp_clean firewire_clean lguest_clean perf_clean selftests_clean \
-		turbostat_clean usb_clean virtio_clean \
+clean: cpupower_clean firewire_clean lguest_clean perf_clean \
+		selftests_clean turbostat_clean usb_clean virtio_clean \
 		x86_energy_perf_policy_clean

Fold this into 2/4

Sam

#9 lore raw

PATCH v4 4/4 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 |   25 ++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)
Makefile +7 -0
index 0df3d003a079..e24ce7104f63 100644
@@ -1468,6 +1468,13 @@ kernelrelease:
 kernelversion:
 	@echo $(KERNELVERSION)
 
+# Clear a bunch of variables before executing the submake
+tools/: FORCE
+	$(Q)$(MAKE) LDFLAGS= -C $(src)/tools/
+
+tools/%: FORCE
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
+
 # Single targets
 # ---------------------------------------------------------------------------
 # Single targets are compatible with:
tools/Makefile +24 -1
index c7ed814e12cf..b2f3bd567ce3 100644
@@ -14,13 +14,23 @@ 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'
 	@echo '    the respective build directory.'
 	@echo '  clean: a summary clean target to clean _all_ folders'
 
-perf firewire lguest usb virtio vm: FORCE
+firewire lguest perf usb virtio vm: FORCE
 	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
 
 cpupower: FORCE
@@ -32,6 +42,19 @@ turbostat x86_energy_perf_policy: FORCE
 selftests: FORCE
 	$(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1)
 
+firewire_install lguest_install perf_install usb_install virtio_install vm_install:
+	$(QUIET_SUBDIR0)$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+cpupower_install:
+	$(QUIET_SUBDIR0)power/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+turbostat_install x86_energy_perf_policy_install:
+	$(QUIET_SUBDIR0)power/x86/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+install: firewire_install lguest_install perf_install usb_install \
+		virtio_install vm_install cpupower_install turbostat_install \
+		x86_energy_perf_policy_install
+
 firewire_clean lguest_clean perf_clean vm_clean usb_clean virtio_clean:
 	$(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean
 
Signature · 1 line
1.7.9.3.362.g71319
#10 lore raw

Re: [PATCH v4 4/4] tools: Connect to the kernel build system

Quoted 42 lines · 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 |   25 ++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)
Makefile +0 -0
index 0df3d003a079..e24ce7104f63 100644

Makefile kernelrelease: · line 1473

Quoted 6 lines
Makefile +3 -0
@@ -1468,6 +1468,13 @@ kernelrelease:
 kernelversion:
 	@echo $(KERNELVERSION)
 
+# Clear a bunch of variables before executing the submake
+tools/: FORCE
+	$(Q)$(MAKE) LDFLAGS= -C $(src)/tools/

I think you need to clear MAKEFLAGS here too?

Quoted 9 lines
Makefile +5 -1
+
+tools/%: FORCE
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
+
 
 
-perf firewire lguest usb virtio vm: FORCE
+firewire lguest perf usb virtio vm: FORCE

$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)

Fold this into 2/4

Quoted 9 lines

cpupower: FORCE

Makefile +3 -0
@@ -32,6 +42,19 @@ turbostat x86_energy_perf_policy: FORCE
 selftests: FORCE
 	$(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1)
 
+firewire_install lguest_install perf_install usb_install virtio_install vm_install:
+	$(QUIET_SUBDIR0)$(@:_install=)/ $(QUIET_SUBDIR1) install
+

Makefile turbostat x86_energy_perf_policy: FORCE · line 57

Quoted 10 lines
Makefile +10 -0
+cpupower_install:
+	$(QUIET_SUBDIR0)power/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+turbostat_install x86_energy_perf_policy_install:
+	$(QUIET_SUBDIR0)power/x86/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+install: firewire_install lguest_install perf_install usb_install \
+		virtio_install vm_install cpupower_install turbostat_install \
+		x86_energy_perf_policy_install
+

This really belongs in 2/4 or a separate patch.

Sorry for bing picky about these details - but they destroy an otherwise fine patch-set.

Sam

#11 lore raw

Re: [PATCH v4 4/4] tools: Connect to the kernel build system

Quoted 85 lines · Sam Ravnborg
Quoted 42 lines · 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 |   25 ++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)
Makefile +0 -0
index 0df3d003a079..e24ce7104f63 100644

Makefile kernelrelease: · line 1473

Quoted 6 lines
Makefile +3 -0
@@ -1468,6 +1468,13 @@ kernelrelease:
 kernelversion:
 	@echo $(KERNELVERSION)
 
+# Clear a bunch of variables before executing the submake
+tools/: FORCE
+	$(Q)$(MAKE) LDFLAGS= -C $(src)/tools/

I think you need to clear MAKEFLAGS here too?

Quoted 9 lines
Makefile +5 -1
+
+tools/%: FORCE
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $*
+
 
 
-perf firewire lguest usb virtio vm: FORCE
+firewire lguest perf usb virtio vm: FORCE

$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)

Fold this into 2/4

Quoted 9 lines

cpupower: FORCE

Makefile +3 -0
@@ -32,6 +42,19 @@ turbostat x86_energy_perf_policy: FORCE
 selftests: FORCE
 	$(QUIET_SUBDIR0)testing/$@/ $(QUIET_SUBDIR1)
 
+firewire_install lguest_install perf_install usb_install virtio_install vm_install:
+	$(QUIET_SUBDIR0)$(@:_install=)/ $(QUIET_SUBDIR1) install
+

Makefile turbostat x86_energy_perf_policy: FORCE · line 57

Quoted 10 lines
Makefile +10 -0
+cpupower_install:
+	$(QUIET_SUBDIR0)power/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+turbostat_install x86_energy_perf_policy_install:
+	$(QUIET_SUBDIR0)power/x86/$(@:_install=)/ $(QUIET_SUBDIR1) install
+
+install: firewire_install lguest_install perf_install usb_install \
+		virtio_install vm_install cpupower_install turbostat_install \
+		x86_energy_perf_policy_install
+

This really belongs in 2/4 or a separate patch.

Quoted 2 lines

Sorry for bing picky about these details - but they destroy an otherwise fine patch-set.

Agreed with all above, will rework soon.

Thanks for looking at those.

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