From: Borislav Petkov <bp@amd64.org>
To: Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Michal Marek <mmarek@suse.cz>, Sam Ravnborg <sam@ravnborg.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH 4/4] tools: Connect to the kernel build system
Date: Thu, 29 Mar 2012 14:25:57 +0200 [thread overview]
Message-ID: <1333023957-22746-5-git-send-email-bp@amd64.org> (raw)
In-Reply-To: <1333023957-22746-1-git-send-email-bp@amd64.org>
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> 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.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
Makefile | 11 +++++++++++
tools/Makefile | 31 +++++++++++++++++++++++++++----
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 1932984478c1..9e85648dd745 100644
--- a/Makefile
+++ b/Makefile
@@ -1468,6 +1468,17 @@ kernelrelease:
kernelversion:
@echo $(KERNELVERSION)
+# empty targets used in tools/Makefile, defined here to suppress error message
+tinstall:
+cleanall:
+
+# Clear a bunch of variables before executing the submake
+tools/: FORCE
+ $(Q)$(MAKE) LDFLAGS= TOOL=help -C tools/ $(patsubst tools/%,%,$(MAKECMDGOALS))
+
+tools/%: FORCE
+ $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= TOOL=$* -C $(src)/tools/ $(patsubst tools/%,%,$(MAKECMDGOALS))
+
# Single targets
# ---------------------------------------------------------------------------
# Single targets are compatible with:
diff --git a/tools/Makefile b/tools/Makefile
index 25566cd74937..dcc86b42021b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,5 +1,7 @@
include scripts/Makefile.include
+default: $(TOOL)
+
help:
@echo 'Possible targets:'
@echo ''
@@ -13,13 +15,19 @@ help:
@echo ' virtio - vhost test module'
@echo ' x86_energy_perf_policy - Intel energy policy tool'
@echo ''
+ @echo 'You can do:'
+ @echo ' $$ make -C tools/ <tool> tinstall'
+ @echo ''
+ @echo ' from the kernel command line to build and install one of'
+ @echo ' the tools above'
+ @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'
+ @echo ' cleanall: a summary clean target to clean _all_ folders'
-perf firewire lguest slub usb virtio: FORCE
+firewire lguest perf slub usb virtio mytest: FORCE
$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
cpupower: FORCE
@@ -28,16 +36,31 @@ cpupower: FORCE
turbostat x86_energy_perf_policy: FORCE
$(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1)
+tinstall: $(TOOL)
+ifeq ($(TOOL),cpupower)
+ $(MAKE) -C power/$(TOOL) install
+else
+ ifeq ($(TOOL),turbostat)
+ $(MAKE) -C power/x86/$(TOOL) install
+ else
+ ifeq ($(TOOL),x86_energy_perf_policy)
+ $(MAKE) -C power/x86/$(TOOL) install
+ else
+ $(MAKE) -C $(TOOL)/ install
+ endif
+ endif
+endif
+
firewire_clean lguest_clean perf_clean slub_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:
$(QUIET_SUBDIR0)power/x86/$(@:_clean=)/ $(QUIET_SUBDIR1) clean
-clean: cp_clean firewire_clean lguest_clean perf_clean slub_clean turbostat_clean \
+cleanall: cpupower_clean firewire_clean lguest_clean perf_clean slub_clean turbostat_clean \
usb_clean virtio_clean x86_energy_perf_policy_clean
.PHONY: FORCE
--
1.7.9.3.362.g71319
next prev parent reply other threads:[~2012-03-29 12:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-29 12:25 [PATCH v3 0/4] tools: Add a toplevel Makefile Borislav Petkov
2012-03-29 12:25 ` [PATCH 1/4] tools: Add Makefile.include Borislav Petkov
2012-03-29 12:25 ` [PATCH 2/4] tools: Add a toplevel Makefile Borislav Petkov
2012-03-29 12:25 ` [PATCH 3/4] tools: Add a help target Borislav Petkov
2012-03-29 12:25 ` Borislav Petkov [this message]
2012-03-30 5:26 ` [PATCH v3 0/4] tools: Add a toplevel Makefile Sam Ravnborg
2012-03-30 16:15 ` Borislav Petkov
2012-03-31 8:49 ` Ingo Molnar
2012-03-31 18:49 ` Sam Ravnborg
2012-04-01 8:42 ` Ingo Molnar
2012-04-01 9:22 ` Borislav Petkov
2012-04-02 15:15 ` Borislav Petkov
2012-04-02 10:18 ` Milton Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333023957-22746-5-git-send-email-bp@amd64.org \
--to=bp@amd64.org \
--cc=acme@infradead.org \
--cc=borislav.petkov@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mmarek@suse.cz \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox