Skip to contentSkip to conversation

tools build: Fix tools Makefile

PATCH Applied Jiri Olsa 3 participants 8 messages Apr 18, 2015 – May 6, 2015

Subsystems (2)
lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

cover tools build: Fix tools Makefile

hi,
sending tools/Makefile fixes discussed in here:
http://marc.info/?t=142250693600001&r=1&w=2

thanks,
jirka
---
Jiri Olsa (3):
tools build: No need to make libapi for perf explicitly
tools build: Fix Makefile(s) to properly invoke tools build
perf tests: Add build tests for building perf from kernel source root and tools

 Makefile              |  5 ++---
 tools/Makefile        | 20 +++++++++++++++-----
 tools/perf/tests/make | 14 +++++++++++++-
 3 files changed, 30 insertions(+), 9 deletions(-)
author reviewer
#1 lore raw

PATCH 1/3 tools build: No need to make libapi for perf explicitly

The perf build handles its dependencies by itself.

Also renaming libapi libapikfs to libapi as it got changed just recently.

---
 tools/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/Makefile +4 -4
index 9a617adc6675..01995cc8ac44 100644
@@ -47,10 +47,10 @@ cgroup firewire hv guest usb virtio vm net: FORCE
 liblockdep: FORCE
 	$(call descend,lib/lockdep)
 
-libapikfs: FORCE
+libapi: FORCE
 	$(call descend,lib/api)
 
-perf: libapikfs FORCE
+perf: FORCE
 	$(call descend,$@)
 
 selftests: FORCE
@@ -97,10 +97,10 @@ cgroup_clean hv_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clea
 liblockdep_clean:
 	$(call descend,lib/lockdep,clean)
 
-libapikfs_clean:
+libapi_clean:
 	$(call descend,lib/api,clean)
 
-perf_clean: libapikfs_clean
+perf_clean:
 	$(call descend,$(@:_clean=),clean)
 
 selftests_clean:
Signature · 1 line
1.9.3
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] tools build: No need to make libapi for perf explicitly

Em Sat, Apr 18, 2015 at 10:34:38PM +0200, Jiri Olsa escreveu:

Quoted 4 lines

The perf build handles its dependencies by itself.

Also renaming libapi libapikfs to libapi as it got changed just recently.

Thanks, applied.

#3 lore raw

[tip:perf/core] tools build: No need to make libapi for perf explicitly

In reply to Jiri Olsa
tools build: No need to make libapi for perf explicitly
Commit-ID:  379a9a28a1b4364ab08fec35c84d39cf4995c509
Gitweb:     http://git.kernel.org/tip/379a9a28a1b4364ab08fec35c84d39cf4995c509
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 18 Apr 2015 22:34:38 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 29 Apr 2015 10:37:46 -0300

tools build: No need to make libapi for perf explicitly

The perf build handles its dependencies by itself.

Also renaming libapi libapikfs to libapi as it got changed just recently.

Cc Borislav Petkov <[email protected]>
Cc Brian Norris <[email protected]>
Cc David Ahern <[email protected]>
Cc David Howells <[email protected]>
Cc Michal Marek <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sam Ravnborg <[email protected]>
---
 tools/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/Makefile +4 -4
index 9a617ad..01995cc 100644
@@ -47,10 +47,10 @@ cgroup firewire hv guest usb virtio vm net: FORCE
 liblockdep: FORCE
 	$(call descend,lib/lockdep)
 
-libapikfs: FORCE
+libapi: FORCE
 	$(call descend,lib/api)
 
-perf: libapikfs FORCE
+perf: FORCE
 	$(call descend,$@)
 
 selftests: FORCE
@@ -97,10 +97,10 @@ cgroup_clean hv_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clea
 liblockdep_clean:
 	$(call descend,lib/lockdep,clean)
 
-libapikfs_clean:
+libapi_clean:
 	$(call descend,lib/api,clean)
 
-perf_clean: libapikfs_clean
+perf_clean:
 	$(call descend,$(@:_clean=),clean)
 
 selftests_clean:
author reviewer
#4 lore raw

PATCH 2/3 tools build: Fix Makefile(s) to properly invoke tools build

In reply to Jiri Olsa

Several fixes were needed to allow following builds:

  $ make tools/tmon
  $ make -C <kernelsrc> tools/perf
  $ make -C <kernelsrc>/tools perf

- some of the tools (perf) use same make variables as in kernel build, unsetting srctree and objtree
- using original $(O) for O variable
- perf build does not follow the descend function setup invoking it via it's own make rule

I tried the rest of the tools/Makefile targets and they seem to work now.

---
 Makefile       |  5 ++---
 tools/Makefile | 12 +++++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)
Makefile +2 -3
index da36a3be7969..b1ca0607ed2e 100644
@@ -214,7 +214,6 @@ VPATH		:= $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
 
 export srctree objtree VPATH
 
-
 # SUBARCH tells the usermode build what the underlying arch is.  That is set
 # first, and if a usermode build is happening, the "ARCH=um" on the command
 # line overrides the setting of ARCH below.  If a native build is happening,
@@ -1504,11 +1503,11 @@ image_name:
 # Clear a bunch of variables before executing the submake
 tools/: FORCE
 	$(Q)mkdir -p $(objtree)/tools
-	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(O) subdir=tools -C $(src)/tools/
 
 tools/%: FORCE
 	$(Q)mkdir -p $(objtree)/tools
-	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/ $*
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(O) subdir=tools -C $(src)/tools/ $*
 
 # Single targets
 # ---------------------------------------------------------------------------
tools/Makefile +11 -1
index 01995cc8ac44..b35102721cbb 100644
@@ -1,3 +1,8 @@
+# Some of the tools (perf) use same make variables
+# as in kernel build.
+export srctree=
+export objtree=
+
 include scripts/Makefile.include
 
 help:
@@ -50,8 +55,13 @@ liblockdep: FORCE
 libapi: FORCE
 	$(call descend,lib/api)
 
+# The perf build does not follow the descend function setup,
+# invoking it via it's own make rule.
+PERF_O   = $(if $(O),$(O)/tools/perf,)
+
 perf: FORCE
-	$(call descend,$@)
+	$(Q)mkdir -p $(PERF_O) .
+	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
 
 selftests: FORCE
 	$(call descend,testing/$@)
Signature · 1 line
1.9.3
#5 lore raw

[tip:perf/core] tools build: Fix Makefile(s) to properly invoke tools build

tools build: Fix Makefile(s) to properly invoke tools build
Commit-ID:  16671c1e1cac2dbb995feb4bc55082fd939b5c2c
Gitweb:     http://git.kernel.org/tip/16671c1e1cac2dbb995feb4bc55082fd939b5c2c
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 18 Apr 2015 22:34:39 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 29 Apr 2015 10:37:46 -0300

tools build: Fix Makefile(s) to properly invoke tools build

Several fixes were needed to allow following builds:

  $ make tools/tmon
  $ make -C <kernelsrc> tools/perf
  $ make -C <kernelsrc>/tools perf

- some of the tools (perf) use same make variables as in kernel build, unsetting srctree and objtree
- using original $(O) for O variable
- perf build does not follow the descend function setup invoking it via it's own make rule

I tried the rest of the tools/Makefile targets and they seem to work now.

---
 Makefile       |  5 ++---
 tools/Makefile | 12 +++++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)
Makefile +2 -3
index da36a3b..b1ca060 100644
@@ -214,7 +214,6 @@ VPATH		:= $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
 
 export srctree objtree VPATH
 
-
 # SUBARCH tells the usermode build what the underlying arch is.  That is set
 # first, and if a usermode build is happening, the "ARCH=um" on the command
 # line overrides the setting of ARCH below.  If a native build is happening,
@@ -1504,11 +1503,11 @@ image_name:
 # Clear a bunch of variables before executing the submake
 tools/: FORCE
 	$(Q)mkdir -p $(objtree)/tools
-	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(O) subdir=tools -C $(src)/tools/
 
 tools/%: FORCE
 	$(Q)mkdir -p $(objtree)/tools
-	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/ $*
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(O) subdir=tools -C $(src)/tools/ $*
 
 # Single targets
 # ---------------------------------------------------------------------------
tools/Makefile +11 -1
index 01995cc..b351027 100644
@@ -1,3 +1,8 @@
+# Some of the tools (perf) use same make variables
+# as in kernel build.
+export srctree=
+export objtree=
+
 include scripts/Makefile.include
 
 help:
@@ -50,8 +55,13 @@ liblockdep: FORCE
 libapi: FORCE
 	$(call descend,lib/api)
 
+# The perf build does not follow the descend function setup,
+# invoking it via it's own make rule.
+PERF_O   = $(if $(O),$(O)/tools/perf,)
+
 perf: FORCE
-	$(call descend,$@)
+	$(Q)mkdir -p $(PERF_O) .
+	$(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir=
 
 selftests: FORCE
 	$(call descend,testing/$@)
author reviewer
#6 lore raw

PATCH 3/3 perf tests: Add build tests for building perf from kernel source root and tools

In reply to Jiri Olsa

Adding build tests for following make commands:

  $ make -C <kernelsrc> tools/perf
  $ make -C <kernelsrc>/tools perf
---
 tools/perf/tests/make | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
tools/perf/tests/make +13 -1
index bff85324f799..901ec9191359 100644
@@ -223,7 +223,19 @@ tarpkg:
 	echo "- $@: $$cmd" && echo $$cmd > $@ && \
 	( eval $$cmd ) >> $@ 2>&1
 
-all: $(run) $(run_O) tarpkg
+make_kernelsrc:
+	@echo " - make -C <kernelsrc> tools/perf"
+	$(call clean); \
+	(make -C ../.. tools/perf) > $@ 2>&1 && \
+	test -x perf && rm -f $@ || (cat $@ ; false)
+
+make_kernelsrc_tools:
+	@echo " - make -C <kernelsrc>/tools perf"
+	$(call clean); \
+	(make -C ../../tools perf) > $@ 2>&1 && \
+	test -x perf && rm -f $@ || (cat $@ ; false)
+
+all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
 	@echo OK
 
 out: $(run_O)
Signature · 1 line
1.9.3
#7 lore raw

[tip:perf/core] perf tests: Add build tests for building perf from kernel source root and tools

perf tests: Add build tests for building perf from kernel source root and tools
Commit-ID:  c41c6647e515c4eb6f754e83e15c1660692c6ce9
Gitweb:     http://git.kernel.org/tip/c41c6647e515c4eb6f754e83e15c1660692c6ce9
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sat, 18 Apr 2015 22:34:40 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 29 Apr 2015 10:37:47 -0300

perf tests: Add build tests for building perf from kernel source root and tools

Adding build tests for following make commands:

  $ make -C <kernelsrc> tools/perf
  $ make -C <kernelsrc>/tools perf
Cc Borislav Petkov <[email protected]>
Cc Brian Norris <[email protected]>
Cc David Ahern <[email protected]>
Cc David Howells <[email protected]>
Cc Michal Marek <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sam Ravnborg <[email protected]>
---
 tools/perf/tests/make | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
tools/perf/tests/make +13 -1
index bff8532..901ec91 100644
@@ -223,7 +223,19 @@ tarpkg:
 	echo "- $@: $$cmd" && echo $$cmd > $@ && \
 	( eval $$cmd ) >> $@ 2>&1
 
-all: $(run) $(run_O) tarpkg
+make_kernelsrc:
+	@echo " - make -C <kernelsrc> tools/perf"
+	$(call clean); \
+	(make -C ../.. tools/perf) > $@ 2>&1 && \
+	test -x perf && rm -f $@ || (cat $@ ; false)
+
+make_kernelsrc_tools:
+	@echo " - make -C <kernelsrc>/tools perf"
+	$(call clean); \
+	(make -C ../../tools perf) > $@ 2>&1 && \
+	test -x perf && rm -f $@ || (cat $@ ; false)
+
+all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
 	@echo OK
 
 out: $(run_O)