diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-10-04 05:11:32 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-09 02:49:01 -0400 |
commit | 684f434cc05a122938b75e055d7d799f1dd58d55 (patch) | |
tree | 62926486c6a31cd4a5aa761ae9b7ee002871e4ed | |
parent | 1c2d1d8cf4dbef33b8c6af6888bed2f4e659220e (diff) |
tools/perf/build: Exclude MAKEFLAGS from nested invocation
In case the user specifies MAKEFLAGS as an environment variable,
or uses 'make -jN' explicitly, the options can conflict and result in:
BUILD: Doing 'make -j8' parallel build
make[1]: warning: -jN forced in submake: disabling jobserver mode.
GEN common-cmds.h
make[1]: *** write jobserver: Bad file descriptor. Stop.
Make sure we invoke the main makefile in a pristine state.
Users who want to do something non-standard can use the:
make -f Makefile.perf
method to invoke the makefile.
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-uen6hzTvkqqngqwjma9yoEgw@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/perf/Makefile | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 6f6f13a13bb6..74f52d8f9631 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -1,3 +1,10 @@ | |||
1 | # | ||
2 | # This is a simple wrapper Makefile that calls the main Makefile.perf | ||
3 | # with a -j option to do parallel builds | ||
4 | # | ||
5 | # If you want to invoke the perf build in some non-standard way then | ||
6 | # you can use the 'make -f Makefile.perf' method to invoke it. | ||
7 | # | ||
1 | 8 | ||
2 | # | 9 | # |
3 | # Clear out the built-in rules GNU make defines by default (such as .o targets), | 10 | # Clear out the built-in rules GNU make defines by default (such as .o targets), |
@@ -6,6 +13,11 @@ | |||
6 | .SUFFIXES: | 13 | .SUFFIXES: |
7 | 14 | ||
8 | # | 15 | # |
16 | # We don't want to pass along options like -j: | ||
17 | # | ||
18 | unexport MAKEFLAGS | ||
19 | |||
20 | # | ||
9 | # Do a parallel build with multiple jobs, based on the number of CPUs online | 21 | # Do a parallel build with multiple jobs, based on the number of CPUs online |
10 | # in this system: 'make -j8' on a 8-CPU system, etc. | 22 | # in this system: 'make -j8' on a 8-CPU system, etc. |
11 | # | 23 | # |
@@ -18,14 +30,12 @@ ifeq ($(JOBS),) | |||
18 | endif | 30 | endif |
19 | endif | 31 | endif |
20 | 32 | ||
21 | export JOBS | ||
22 | |||
23 | define print_msg | 33 | define print_msg |
24 | @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' | 34 | @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' |
25 | endef | 35 | endef |
26 | 36 | ||
27 | define make | 37 | define make |
28 | @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@ | 38 | @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(O) $@ |
29 | endef | 39 | endef |
30 | 40 | ||
31 | # | 41 | # |