1684f434cSIngo Molnar# 2684f434cSIngo Molnar# This is a simple wrapper Makefile that calls the main Makefile.perf 3684f434cSIngo Molnar# with a -j option to do parallel builds 4684f434cSIngo Molnar# 5684f434cSIngo Molnar# If you want to invoke the perf build in some non-standard way then 6684f434cSIngo Molnar# you can use the 'make -f Makefile.perf' method to invoke it. 7684f434cSIngo Molnar# 8b016a0ddSIngo Molnar 9b016a0ddSIngo Molnar# 10b016a0ddSIngo Molnar# Clear out the built-in rules GNU make defines by default (such as .o targets), 11b016a0ddSIngo Molnar# so that we pass through all targets to Makefile.perf: 12b016a0ddSIngo Molnar# 13b016a0ddSIngo Molnar.SUFFIXES: 14b016a0ddSIngo Molnar 15bd69cc28SIngo Molnar# 16684f434cSIngo Molnar# We don't want to pass along options like -j: 17684f434cSIngo Molnar# 18684f434cSIngo Molnarunexport MAKEFLAGS 19684f434cSIngo Molnar 20684f434cSIngo Molnar# 21bd69cc28SIngo Molnar# Do a parallel build with multiple jobs, based on the number of CPUs online 22bd69cc28SIngo Molnar# in this system: 'make -j8' on a 8-CPU system, etc. 23bd69cc28SIngo Molnar# 24bd69cc28SIngo Molnar# (To override it, run 'make JOBS=1' and similar.) 25bd69cc28SIngo Molnar# 26bd69cc28SIngo Molnarifeq ($(JOBS),) 27bd69cc28SIngo Molnar JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) 28bd69cc28SIngo Molnar ifeq ($(JOBS),) 29bd69cc28SIngo Molnar JOBS := 1 30bd69cc28SIngo Molnar endif 31bd69cc28SIngo Molnarendif 32c29ede61SArnaldo Carvalho de Melo 33b102420bSIngo Molnar# 34b102420bSIngo Molnar# Only pass canonical directory names as the output directory: 35b102420bSIngo Molnar# 36b102420bSIngo Molnarifneq ($(O),) 373fb66335SIngo Molnar FULL_O := $(shell readlink -f $(O) || echo $(O)) 38b102420bSIngo Molnarendif 39b102420bSIngo Molnar 40fcf92585SIngo Molnar# 41fcf92585SIngo Molnar# Only accept the 'DEBUG' variable from the command line: 42fcf92585SIngo Molnar# 43fcf92585SIngo Molnarifeq ("$(origin DEBUG)", "command line") 44fcf92585SIngo Molnar ifeq ($(DEBUG),) 45fcf92585SIngo Molnar override DEBUG = 0 46fcf92585SIngo Molnar else 47fcf92585SIngo Molnar SET_DEBUG = "DEBUG=$(DEBUG)" 48fcf92585SIngo Molnar endif 49fcf92585SIngo Molnarelse 50fcf92585SIngo Molnar override DEBUG = 0 51fcf92585SIngo Molnarendif 52fcf92585SIngo Molnar 5373a725f0SIngo Molnardefine print_msg 5473a725f0SIngo Molnar @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' 5573a725f0SIngo Molnarendef 5673a725f0SIngo Molnar 5773a725f0SIngo Molnardefine make 58fcf92585SIngo Molnar @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@ 5973a725f0SIngo Molnarendef 60bd69cc28SIngo Molnar 61bd69cc28SIngo Molnar# 62bd69cc28SIngo Molnar# Needed if no target specified: 63bd69cc28SIngo Molnar# 64a3d1ee10SMichael Wittenall: 6573a725f0SIngo Molnar $(print_msg) 6673a725f0SIngo Molnar $(make) 6786470930SIngo Molnar 6873a725f0SIngo Molnar# 6973a725f0SIngo Molnar# The clean target is not really parallel, don't print the jobs info: 7073a725f0SIngo Molnar# 7173a725f0SIngo Molnarclean: 7273a725f0SIngo Molnar $(make) 7373a725f0SIngo Molnar 7473a725f0SIngo Molnar# 7573a725f0SIngo Molnar# All other targets get passed through: 7673a725f0SIngo Molnar# 77bd69cc28SIngo Molnar%: 7873a725f0SIngo Molnar $(print_msg) 7973a725f0SIngo Molnar $(make) 80