All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/2] tools: Add a toplevel Makefile
Date: Mon, 26 Mar 2012 16:05:05 +0200	[thread overview]
Message-ID: <20120326140505.GD32090@aftab> (raw)
In-Reply-To: <20120326122632.GC32090@aftab>

On Mon, Mar 26, 2012 at 02:26:32PM +0200, Borislav Petkov wrote:
> On Sat, Mar 24, 2012 at 08:44:12AM +0100, Ingo Molnar wrote:
> > Could this also be accessible via 'make tools' in the toplevel 
> > Makefile?
> > 
> > I'd love to be able to type:
> > 
> >   make -j tools perf install
> 
> Well,
> 
> you could do
> 
> $ make -j -C tools perf
> 
> which builds perf. I'd need to make it work with the install target too
> so that when you do
> 
> $ make -j -C tools perf install
> 
> it knows that you mean the install target of perf. Let me play with it a
> bit ...

Yep, we can do that, below is a possible version:

This way you can do

$ make -j -C tools <tool> install

for example. It cannot handle multiple tools yet, i.e.

$ make -j -C tools <tool1> <tool2> install

because it doesn't seem make a whole lot of sense to me right now
(besides, make is really clumsy for such stuff :)

help is still the default target when you do

$ make -C tools

with no explicit build target.

Hmm...

--
diff --git a/tools/Makefile b/tools/Makefile
index 25566cd74937..03fa9432d54b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,5 +1,11 @@
 include scripts/Makefile.include
 
+TOOL:=perf
+
+ifeq ($(findstring install,$(MAKECMDGOALS)), install)
+	TOOL:=$(filter-out install, $(MAKECMDGOALS))
+endif
+
 help:
 	@echo 'Possible targets:'
 	@echo ''
@@ -13,13 +19,18 @@ 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> install'
+	@echo ''
+	@echo '  from the kernel command line to build and install one of 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: FORCE
 	$(QUIET_SUBDIR0)$@/ $(QUIET_SUBDIR1)
 
 cpupower: FORCE
@@ -28,16 +39,31 @@ cpupower: FORCE
 turbostat x86_energy_perf_policy: FORCE
 	$(QUIET_SUBDIR0)power/x86/$@/ $(QUIET_SUBDIR1)
 
+install: $(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

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

  reply	other threads:[~2012-03-26 14:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23 14:43 [PATCH 0/2] tools: Add a toplevel Makefile Borislav Petkov
2012-03-23 14:43 ` [PATCH 1/3] tools: Add Makefile.include Borislav Petkov
2012-03-23 14:43 ` [PATCH 2/3] tools: Add a toplevel Makefile Borislav Petkov
2012-03-23 14:43 ` [PATCH 3/3] tools: Add a help target Borislav Petkov
2012-03-24  7:44 ` [PATCH 0/2] tools: Add a toplevel Makefile Ingo Molnar
2012-03-26 12:26   ` Borislav Petkov
2012-03-26 14:05     ` Borislav Petkov [this message]
2012-03-26 15:14     ` Ingo Molnar
2012-03-26 15:41       ` Borislav Petkov
2012-03-28  7:25         ` Ingo Molnar
2012-03-28  9:51           ` Borislav Petkov
2012-03-28 17:57             ` Borislav Petkov
2012-03-29 11:21               ` Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2012-03-22 17:01 Borislav Petkov

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=20120326140505.GD32090@aftab \
    --to=bp@amd64.org \
    --cc=acme@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.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 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.