Skip to contentSkip to conversation

perf tools: Fix parallel build including 'clean' target

tip:perf/core tip-bot for Jiri Olsa 1 participant 1 message Feb 9, 2016 perf events

lore
Share & tools
lore

tip-bot for Jiri Olsa

author merge bot
#0 lore raw
Commit-ID:  3e2751d9169563486c2bfe7382726f1315cb156b
Gitweb:     http://git.kernel.org/tip/3e2751d9169563486c2bfe7382726f1315cb156b
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 4 Feb 2016 12:30:36 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 4 Feb 2016 15:53:16 -0300

perf tools: Fix parallel build including 'clean' target

Do not parallelize 'clean' with other targets, figure out if it is present and do it first, then the other targets.

Noticed with:

tools/perf> make -j24 clean all

LD arch/libperf-in.o
LD plugin_xen-in.o
arch//libperf-in.o: file not recognized: File truncated make[3]: *** [arch/libperf-in.o] Error 1 make[2]: *** [arch] Error 2
make[2]: *** Waiting for unfinished jobs....
AR libapi.a

---
 tools/perf/Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
tools/perf/Makefile +14 -0
index 4b68f46..67837c6 100644
@@ -68,6 +68,20 @@ all tags TAGS:
 	$(print_msg)
 	$(make)
 
+ifdef MAKECMDGOALS
+has_clean := 0
+ifneq ($(filter clean,$(MAKECMDGOALS)),)
+  has_clean := 1
+endif # clean
+
+ifeq ($(has_clean),1)
+  rest := $(filter-out clean,$(MAKECMDGOALS))
+  ifneq ($(rest),)
+$(rest): clean
+  endif # rest
+endif # has_clean
+endif # MAKECMDGOALS
+
 #
 # The clean target is not really parallel, don't print the jobs info:
 #