2013-10-04 09:11:32 +00:00
|
|
|
#
|
|
|
|
# This is a simple wrapper Makefile that calls the main Makefile.perf
|
|
|
|
# with a -j option to do parallel builds
|
|
|
|
#
|
|
|
|
# If you want to invoke the perf build in some non-standard way then
|
|
|
|
# you can use the 'make -f Makefile.perf' method to invoke it.
|
|
|
|
#
|
2013-10-03 12:32:10 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Clear out the built-in rules GNU make defines by default (such as .o targets),
|
|
|
|
# so that we pass through all targets to Makefile.perf:
|
|
|
|
#
|
|
|
|
.SUFFIXES:
|
|
|
|
|
2013-10-04 09:11:32 +00:00
|
|
|
#
|
|
|
|
# We don't want to pass along options like -j:
|
|
|
|
#
|
|
|
|
unexport MAKEFLAGS
|
|
|
|
|
2012-10-01 16:32:51 +00:00
|
|
|
#
|
2013-10-02 09:49:08 +00:00
|
|
|
# Do a parallel build with multiple jobs, based on the number of CPUs online
|
|
|
|
# in this system: 'make -j8' on a 8-CPU system, etc.
|
2013-01-28 01:51:22 +00:00
|
|
|
#
|
2013-10-02 09:49:08 +00:00
|
|
|
# (To override it, run 'make JOBS=1' and similar.)
|
2013-05-24 12:35:24 +00:00
|
|
|
#
|
2013-10-02 09:49:08 +00:00
|
|
|
ifeq ($(JOBS),)
|
|
|
|
JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
|
|
|
|
ifeq ($(JOBS),)
|
|
|
|
JOBS := 1
|
2013-04-15 02:06:58 +00:00
|
|
|
endif
|
2012-08-07 13:20:43 +00:00
|
|
|
endif
|
2010-08-21 00:38:20 +00:00
|
|
|
|
2013-10-04 10:08:05 +00:00
|
|
|
#
|
|
|
|
# Only pass canonical directory names as the output directory:
|
|
|
|
#
|
|
|
|
ifneq ($(O),)
|
2013-10-09 15:00:23 +00:00
|
|
|
FULL_O := $(shell readlink -f $(O) || echo $(O))
|
2013-10-04 10:08:05 +00:00
|
|
|
endif
|
|
|
|
|
2013-10-10 06:05:25 +00:00
|
|
|
#
|
|
|
|
# Only accept the 'DEBUG' variable from the command line:
|
|
|
|
#
|
|
|
|
ifeq ("$(origin DEBUG)", "command line")
|
|
|
|
ifeq ($(DEBUG),)
|
|
|
|
override DEBUG = 0
|
|
|
|
else
|
|
|
|
SET_DEBUG = "DEBUG=$(DEBUG)"
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
override DEBUG = 0
|
|
|
|
endif
|
|
|
|
|
2013-10-02 09:58:30 +00:00
|
|
|
define print_msg
|
2013-10-09 09:49:27 +00:00
|
|
|
@printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
|
2013-10-02 09:58:30 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define make
|
2013-10-10 06:05:25 +00:00
|
|
|
@$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
|
2013-10-02 09:58:30 +00:00
|
|
|
endef
|
2009-04-20 11:32:07 +00:00
|
|
|
|
2013-10-02 07:43:23 +00:00
|
|
|
#
|
2013-10-02 09:49:08 +00:00
|
|
|
# Needed if no target specified:
|
2013-11-26 12:54:12 +00:00
|
|
|
# (Except for tags and TAGS targets. The reason is that the
|
|
|
|
# Makefile does not treat tags/TAGS as targets but as files
|
|
|
|
# and thus won't rebuilt them once they are in place.)
|
2013-10-02 07:43:23 +00:00
|
|
|
#
|
2013-11-26 12:54:12 +00:00
|
|
|
all tags TAGS:
|
2013-10-02 09:58:30 +00:00
|
|
|
$(print_msg)
|
|
|
|
$(make)
|
|
|
|
|
|
|
|
#
|
|
|
|
# The clean target is not really parallel, don't print the jobs info:
|
|
|
|
#
|
|
|
|
clean:
|
|
|
|
$(make)
|
2013-10-01 14:28:09 +00:00
|
|
|
|
2013-10-02 09:58:30 +00:00
|
|
|
#
|
|
|
|
# All other targets get passed through:
|
|
|
|
#
|
2013-10-02 09:49:08 +00:00
|
|
|
%:
|
2013-10-02 09:58:30 +00:00
|
|
|
$(print_msg)
|
|
|
|
$(make)
|
2013-11-26 12:54:12 +00:00
|
|
|
|
|
|
|
.PHONY: tags TAGS
|