tools: Add a toplevel Makefile
cover tools: Add a toplevel Makefile
From: Borislav Petkov <[email protected]>
Hi all,
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.
Any comments/suggestions are welcome,
thanks.
PATCH 1/2 tools: Add Makefile.lib
From: Borislav Petkov <[email protected]>
Put generic enough build settings which could be reused by other tools into a common Makefile.lib file.
--- tools/perf/Makefile | 45 +----------------------------------- tools/scripts/Makefile.lib | 55 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 44 deletions(-) create mode 100644 tools/scripts/Makefile.lib
tools/perf/Makefile +1 -44
@@ -1,18 +1,10 @@ -ifeq ("$(origin O)", "command line") - OUTPUT := $(O)/ -endif +include ../scripts/Makefile.lib # 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 PYTHON to point to the python binary if the default
@@ -70,31 +62,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
@@ -619,16 +586,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 $@; -endif -endif - ifdef ASCIIDOC8 export ASCIIDOC8 endif
tools/scripts/Makefile.lib new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
1.7.9.3.362.g71319
Re: [PATCH 1/2] tools: Add Makefile.lib
Quoted 4 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Put generic enough build settings which could be reused by other tools into a common Makefile.lib file.
I assume that the reason to use the filename "Makefile.lib" is that scripts/Makefile.lib uses the same extension.
But whoever idiot(*) that decided to use that extension deserve to be shot! It is not a library per see, it is just a bunch of stuff you include in another makefile.
So Makefile.include would be better - and as an added benefit vim does not barf on it.
(*) I actually shave him quite often...
Sam
Re: [PATCH 1/2] tools: Add Makefile.lib
Quoted 8 lines · Sam Ravnborg
Quoted 4 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Put generic enough build settings which could be reused by other tools into a common Makefile.lib file.
I assume that the reason to use the filename "Makefile.lib" is that
scripts/Makefile.libuses the same extension.
Yep.
Quoted 1 line
But whoever
idiot(*)that decided to use that extension deserve to be shot!
Ye^W^W.. oops, oh no, please no! :-)
Quoted 4 lines
It is not a library per see, it is just a bunch of stuff you include in another makefile.
So Makefile.include would be better - and as an added benefit vim does not barf on it.
Makes sense, will do, thanks.
Quoted 1 line
(*) I actually shave him quite often...
LOL.
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
PATCH 2/2 tools: Add a toplevel Makefile
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Add a Makefile with all the targets under tools/. Make perf the default one and add a minimalistic Makefile to slub/ for completeness.
--- tools/Makefile | 24 ++++++++++++++++++++++++ tools/slub/Makefile | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 tools/Makefile create mode 100644 tools/slub/Makefile
tools/Makefile new file +24 -0
@@ -0,0 +1,24 @@ +include scripts/Makefile.lib + +perf firewire lguest slub usb virtio: FORCE + $(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1) + +cpupower: FORCE + $(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1) + +turbostat x86_energy_perf_policy: FORCE + $(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1) + +firewire_clean lguest_clean perf_clean slub_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 + +clean: cp_clean firewire_clean lguest_clean perf_clean slub_clean turbostat_clean \ + usb_clean virtio_clean x86_energy_perf_policy_clean + +.PHONY: FORCE
tools/slub/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +slabinfo: slabinfo.c + +clean: + rm -rf slabinfo
Signature · 1 line
1.7.9.3.362.g71319
Quoted 15 lines · Borislav Petkov
index 000000000000..97631367e0db
tools/Makefile new file +11
-0@@ -0,0 +1,24 @@ +include scripts/Makefile.lib + +perf firewire lguest slub usb virtio: FORCE + $(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1) + +cpupower: FORCE + $(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1) + +turbostat x86_energy_perf_policy: FORCE + $(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1) +
tools/Makefile line 21
Quoted 10 lines
tools/Makefile new file +10
-0+firewire_clean lguest_clean perf_clean slub_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 + +clean: cp_clean firewire_clean lguest_clean perf_clean slub_clean turbostat_clean \
slub_clean? Where is that target defined?
tools/slub/Makefile line 4
Quoted 10 lines
tools/slub/Makefile new file +4
-0@@ -0,0 +1,4 @@ +slabinfo: slabinfo.c + +clean: + rm -rf slabinfo
That portion looks okay.
Quoted 18 lines · Christoph Lameter
Quoted 6 lines · Borislav Petkov
index 000000000000..97631367e0db
tools/Makefile new file +2
-0@@ -0,0 +1,24 @@ +include scripts/Makefile.lib +tools/Makefile line 12
Quoted 10 lines
tools/Makefile new file +10
-0+perf firewire lguest slub usb virtio: FORCE + $(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1) + +cpupower: FORCE + $(QUIET_SUBDIR0)power/$@/ $(QUIET_SUBDIR1) + +turbostat x86_energy_perf_policy: FORCE + $(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1) + +firewire_clean lguest_clean perf_clean slub_clean usb_clean virtio_clean:
^^^---------------------------------------------- |
Quoted 11 lines
tools/Makefile
Quoted 10 lines
tools/Makefile new file +1
-0+ $(QUIET_SUBDIR0)$(@:_clean=)/ $(QUIET_SUBDIR1) clean ||tools/Makefile new file +8
-0+ | +cp_clean: | + $(QUIET_SUBDIR0)power/cpupower/ $(QUIET_SUBDIR1) clean | + | +turbostat_clean x86_energy_perf_policy_clean: | + $(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean | + | +clean: cp_clean firewire_clean lguest_clean perf_clean slub_clean turbostat_clean \ ||
Quoted 1 line
slub_clean? Where is that target defined? |
|
Here---------------------------------------------------------------------------------------------
:-).
It basically does:
$ make -C slub/ clean
which runs the target of the same name in the Makefile in slub/.
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
Christoph Lameter
Acked-byQuoted 5 lines · Borislav Petkov
It basically does:
$ make -C slub/ cleanwhich runs the target of the same name in the
Makefilein slub/.
Ok.
Quoted 11 lines · Christoph Lameter
Quoted 5 lines · Borislav Petkov
It basically does:
$ make -C slub/ cleanwhich runs the target of the same name in the
Makefilein slub/.Ok.
Didn't Andrew already patches that moved this under tools/vm and added proper Makefiles for it?
Quoted 2 lines · Pekka Enberg
Didn't Andrew already patches that moved this under
tools/vmand added proper Makefiles for it?
Yeah, he did. It went upstream on Wed:
commit 63e315535abe0d820d0e3db4c06bc5de74aeefc8
Author: Dave Young <[email protected]> Date: Wed Mar 28 14:42:55 2012 -0700
mm: move slabinfo.c to tools/vm
We have tools/vm/ folder for vm tools, so move slabinfo.c from tools/slub/ to tools/vm/
I'll have to readjust my patchset then.
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