1 # SPDX-License-Identifier: GPL-2.0
3 # This is a simple wrapper Makefile that calls the main Makefile.perf
4 # with a -j option to do parallel builds
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.
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:
17 # We don't want to pass along options like -j:
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.
25 # (To override it, run 'make JOBS=1' and similar.)
28 JOBS
:= $(shell (getconf _NPROCESSORS_ONLN || egrep
-c
'^processor|^CPU[0-9]' /proc
/cpuinfo
) 2>/dev
/null
)
35 # Only pass canonical directory names as the output directory:
38 FULL_O
:= $(shell readlink
-f
$(O
) || echo
$(O
))
42 # Only accept the 'DEBUG' variable from the command line:
44 ifeq ("$(origin DEBUG)", "command line")
48 SET_DEBUG
= "DEBUG=$(DEBUG)"
55 @printf
' BUILD: Doing '\''make \033[33m-j'$(JOBS
)'\033[m'\'' parallel build\n'
59 @
$(MAKE
) -f Makefile.perf
--no-print-directory
-j
$(JOBS
) O
=$(FULL_O
) $(SET_DEBUG
) $@
63 # Needed if no target specified:
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.)
74 ifneq ($(filter clean,$(MAKECMDGOALS
)),)
79 rest
:= $(filter-out clean,$(MAKECMDGOALS
))
87 # The clean target is not really parallel, don't print the jobs info:
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
98 # For a full test, use:
100 # make -C tools/perf -f tests/make
103 @
$(MAKE
) SHUF
=1 -f tests
/make REUSE_FEATURES_DUMP
=1 MK
=Makefile SET_PARALLEL
=1 --no-print-directory tarpkg out
106 # All other targets get passed through:
112 .PHONY
: tags TAGS FORCE Makefile