1 # SPDX-License-Identifier: GPL-2.0 2 # 3 # This is a simple wrapper Makefile that calls 4 # with a -j option to do parallel builds 5 # 6 # If you want to invoke the perf build in some 7 # you can use the 'make -f Makefile.perf' meth 8 # 9 10 # 11 # Clear out the built-in rules GNU make define 12 # so that we pass through all targets to Makef 13 # 14 .SUFFIXES: 15 16 # 17 # We don't want to pass along options like -j: 18 # 19 unexport MAKEFLAGS 20 21 # 22 # Do a parallel build with multiple jobs, base 23 # in this system: 'make -j8' on a 8-CPU system 24 # 25 # (To override it, run 'make JOBS=1' and simil 26 # 27 ifeq ($(JOBS),) 28 JOBS := $(shell (getconf _NPROCESSORS_ONLN | 29 ifeq ($(JOBS),0) 30 JOBS := 1 31 endif 32 endif 33 34 # 35 # Only pass canonical directory names as the o 36 # 37 ifneq ($(O),) 38 FULL_O := $(shell cd $(PWD); readlink -f $(O 39 endif 40 41 # 42 # Only accept the 'DEBUG' variable from the co 43 # 44 ifeq ("$(origin DEBUG)", "command line") 45 ifeq ($(DEBUG),) 46 override DEBUG = 0 47 else 48 SET_DEBUG = "DEBUG=$(DEBUG)" 49 endif 50 else 51 override DEBUG = 0 52 endif 53 54 ifeq ($(JOBS),1) 55 BUILD_TYPE := sequential 56 else 57 BUILD_TYPE := parallel 58 endif 59 60 define print_msg 61 @printf ' BUILD: Doing '\''make \033[33m- 62 endef 63 64 define make 65 @$(MAKE) -f Makefile.perf --no-print-directo 66 endef 67 68 # 69 # Needed if no target specified: 70 # (Except for tags and TAGS targets. The reaso 71 # Makefile does not treat tags/TAGS as targets 72 # and thus won't rebuilt them once they are in 73 # 74 all tags TAGS: 75 $(print_msg) 76 $(make) 77 78 ifdef MAKECMDGOALS 79 has_clean := 0 80 ifneq ($(filter clean,$(MAKECMDGOALS)),) 81 has_clean := 1 82 endif # clean 83 84 ifeq ($(has_clean),1) 85 rest := $(filter-out clean,$(MAKECMDGOALS)) 86 ifneq ($(rest),) 87 $(rest): clean 88 endif # rest 89 endif # has_clean 90 endif # MAKECMDGOALS 91 92 # 93 # Explicitly disable parallelism for the clean 94 # 95 clean: 96 $(make) -j1 97 98 # 99 # The build-test target is not really parallel 100 # it also uses only the tests/make targets tha 101 # repository, i.e. that uses O= or builds the 102 # repo directories. 103 # 104 # For a full test, use: 105 # 106 # make -C tools/perf -f tests/make 107 # 108 build-test: 109 @$(MAKE) SHUF=1 -f tests/make REUSE_FE 110 111 build-test-tarball: 112 @$(MAKE) -f tests/make REUSE_FEATURES_ 113 114 # 115 # All other targets get passed through: 116 # 117 %: FORCE 118 $(print_msg) 119 $(make) 120 121 .PHONY: tags TAGS FORCE Makefile
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.