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