aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells2012-11-05 15:02:08 -0600
committerDavid Howells2012-11-19 16:10:30 -0600
commitbf35182ffcd00d8b36d56210ffdac110e5624d7d (patch)
tree222537ccd17378d77de88702aa35a4d671f64aeb /Makefile
parentca9dfc6cc45a8ae0297188f5fed23af242cc8a8d (diff)
downloadlinux-phy-bf35182ffcd00d8b36d56210ffdac110e5624d7d.tar.gz
linux-phy-bf35182ffcd00d8b36d56210ffdac110e5624d7d.tar.xz
linux-phy-bf35182ffcd00d8b36d56210ffdac110e5624d7d.zip
tools: Honour the O= flag when tool build called from a higher Makefile
Honour the O= flag that was passed to a higher level Makefile and then passed down as part of a tool build. To make this work, the top-level Makefile passes the original O= flag and subdir=tools to the tools/Makefile, and that in turn passes subdir=$(O)/$(subdir)/foodir when building tool foo in directory $(O)/$(subdir)/foodir (where the intervening slashes aren't added if an element is missing). For example, take perf. This is found in tools/perf/. Assume we're building into directory ~/zebra/, so we pass O=~/zebra to make. Dependening on where we run the build from, we see: make run in dir $(OUTPUT) dir ======================= ================== linux ~/zebra/tools/perf/ linux/tools ~/zebra/perf/ linux/tools/perf ~/zebra/ and if O= is not set, we get: make run in dir $(OUTPUT) dir ======================= ================== linux linux/tools/perf/ linux/tools linux/tools/perf/ linux/tools/perf linux/tools/perf/ The output directories are created by the descend function if they don't already exist. Signed-off-by: David Howells <dhowells@redhat.com> Cc: Borislav Petkov <bp@amd64.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1378.1352379110@warthog.procyon.org.uk Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 4 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 42d0e56818ea..71dc31e41407 100644
--- a/Makefile
+++ b/Makefile
@@ -1321,10 +1321,12 @@ kernelversion:
1321 1321
1322# Clear a bunch of variables before executing the submake 1322# Clear a bunch of variables before executing the submake
1323tools/: FORCE 1323tools/: FORCE
1324 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ 1324 $(Q)mkdir -p $(objtree)/tools
1325 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/
1325 1326
1326tools/%: FORCE 1327tools/%: FORCE
1327 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= -C $(src)/tools/ $* 1328 $(Q)mkdir -p $(objtree)/tools
1329 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $*
1328 1330
1329# Single targets 1331# Single targets
1330# --------------------------------------------------------------------------- 1332# ---------------------------------------------------------------------------