]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - tools/perf/Makefile
KVM: SVM: Move spec control call after restore of GS
[mirror_ubuntu-artful-kernel.git] / tools / perf / Makefile
CommitLineData
684f434c
IM
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#
b016a0dd
IM
8
9#
10# Clear out the built-in rules GNU make defines by default (such as .o targets),
11# so that we pass through all targets to Makefile.perf:
12#
13.SUFFIXES:
14
684f434c
IM
15#
16# We don't want to pass along options like -j:
17#
18unexport MAKEFLAGS
19
4e34d958 20#
bd69cc28
IM
21# Do a parallel build with multiple jobs, based on the number of CPUs online
22# in this system: 'make -j8' on a 8-CPU system, etc.
79d824e3 23#
bd69cc28 24# (To override it, run 'make JOBS=1' and similar.)
4e22db46 25#
bd69cc28 26ifeq ($(JOBS),)
762abdc0 27 JOBS := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
c65568c5 28 ifeq ($(JOBS),0)
bd69cc28 29 JOBS := 1
8e1b3f68 30 endif
2bcd355b 31endif
f4e7ac0a 32
b102420b
IM
33#
34# Only pass canonical directory names as the output directory:
35#
36ifneq ($(O),)
3fb66335 37 FULL_O := $(shell readlink -f $(O) || echo $(O))
b102420b
IM
38endif
39
fcf92585
IM
40#
41# Only accept the 'DEBUG' variable from the command line:
42#
43ifeq ("$(origin DEBUG)", "command line")
44 ifeq ($(DEBUG),)
45 override DEBUG = 0
46 else
47 SET_DEBUG = "DEBUG=$(DEBUG)"
48 endif
49else
50 override DEBUG = 0
51endif
52
73a725f0 53define print_msg
65fb0992 54 @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
73a725f0
IM
55endef
56
57define make
fcf92585 58 @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
73a725f0 59endef
d24e473e 60
de0f03fb 61#
bd69cc28 62# Needed if no target specified:
26286141
JO
63# (Except for tags and TAGS targets. The reason is that the
64# Makefile does not treat tags/TAGS as targets but as files
65# and thus won't rebuilt them once they are in place.)
de0f03fb 66#
26286141 67all tags TAGS:
73a725f0
IM
68 $(print_msg)
69 $(make)
70
3e2751d9
JO
71ifdef MAKECMDGOALS
72has_clean := 0
73ifneq ($(filter clean,$(MAKECMDGOALS)),)
74 has_clean := 1
75endif # clean
76
77ifeq ($(has_clean),1)
78 rest := $(filter-out clean,$(MAKECMDGOALS))
79 ifneq ($(rest),)
80$(rest): clean
81 endif # rest
82endif # has_clean
83endif # MAKECMDGOALS
84
73a725f0
IM
85#
86# The clean target is not really parallel, don't print the jobs info:
87#
88clean:
89 $(make)
c72e3f04 90
a7077234 91#
a639a623
ACM
92# The build-test target is not really parallel, don't print the jobs info,
93# it also uses only the tests/make targets that don't pollute the source
94# repository, i.e. that uses O= or builds the tarpkg outside the source
95# repo directories.
96#
97# For a full test, use:
98#
99# make -C tools/perf -f tests/make
a7077234
NK
100#
101build-test:
be9e4991 102 @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg out
a7077234 103
73a725f0
IM
104#
105# All other targets get passed through:
106#
8e557351 107%: FORCE
73a725f0
IM
108 $(print_msg)
109 $(make)
26286141 110
8e557351 111.PHONY: tags TAGS FORCE Makefile