Linux Audio

Check our new training course

Loading...
v4.17
  1# SPDX-License-Identifier: GPL-2.0
  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#
  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
 16#
 17# We don't want to pass along options like -j:
 18#
 19unexport MAKEFLAGS
 20
 21#
 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.
 24#
 25# (To override it, run 'make JOBS=1' and similar.)
 26#
 27ifeq ($(JOBS),)
 28  JOBS := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
 29  ifeq ($(JOBS),0)
 30    JOBS := 1
 31  endif
 32endif
 33
 34#
 35# Only pass canonical directory names as the output directory:
 36#
 37ifneq ($(O),)
 38  FULL_O := $(shell readlink -f $(O) || echo $(O))
 39endif
 40
 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
 
 
 
 
 
 
 54define print_msg
 55  @printf '  BUILD:   Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
 56endef
 57
 58define make
 59  @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
 60endef
 61
 62#
 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.)
 67#
 68all tags TAGS:
 69	$(print_msg)
 70	$(make)
 71
 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
 86#
 87# The clean target is not really parallel, don't print the jobs info:
 88#
 89clean:
 90	$(make)
 91
 92#
 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
101#
102build-test:
103	@$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg out
 
 
 
104
105#
106# All other targets get passed through:
107#
108%: FORCE
109	$(print_msg)
110	$(make)
111
112.PHONY: tags TAGS FORCE Makefile
v6.13.7
  1# SPDX-License-Identifier: GPL-2.0
  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#
  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
 16#
 17# We don't want to pass along options like -j:
 18#
 19unexport MAKEFLAGS
 20
 21#
 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.
 24#
 25# (To override it, run 'make JOBS=1' and similar.)
 26#
 27ifeq ($(JOBS),)
 28  JOBS := $(shell (getconf _NPROCESSORS_ONLN || grep -E -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
 29  ifeq ($(JOBS),0)
 30    JOBS := 1
 31  endif
 32endif
 33
 34#
 35# Only pass canonical directory names as the output directory:
 36#
 37ifneq ($(O),)
 38  FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O))
 39endif
 40
 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
 54ifeq ($(JOBS),1)
 55  BUILD_TYPE := sequential
 56else
 57  BUILD_TYPE := parallel
 58endif
 59
 60define print_msg
 61  @printf '  BUILD:   Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' $(BUILD_TYPE) build\n'
 62endef
 63
 64define make
 65  @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
 66endef
 67
 68#
 69# Needed if no target specified:
 70# (Except for tags and TAGS targets. The reason is that the
 71# Makefile does not treat tags/TAGS as targets but as files
 72# and thus won't rebuilt them once they are in place.)
 73#
 74all tags TAGS:
 75	$(print_msg)
 76	$(make)
 77
 78ifdef MAKECMDGOALS
 79has_clean := 0
 80ifneq ($(filter clean,$(MAKECMDGOALS)),)
 81  has_clean := 1
 82endif # clean
 83
 84ifeq ($(has_clean),1)
 85  rest := $(filter-out clean,$(MAKECMDGOALS))
 86  ifneq ($(rest),)
 87$(rest): clean
 88  endif # rest
 89endif # has_clean
 90endif # MAKECMDGOALS
 91
 92#
 93# Explicitly disable parallelism for the clean target.
 94#
 95clean:
 96	$(make) -j1
 97
 98#
 99# The build-test target is not really parallel, don't print the jobs info,
100# it also uses only the tests/make targets that don't pollute the source
101# repository, i.e. that uses O= or builds the tarpkg outside the source
102# repo directories.
103#
104# For a full test, use:
105#
106# make -C tools/perf -f tests/make
107#
108build-test:
109	@$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk2 out
110
111build-test-tarball:
112	@$(MAKE) -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory out
113
114#
115# All other targets get passed through:
116#
117%: FORCE
118	$(print_msg)
119	$(make)
120
121.PHONY: tags TAGS FORCE Makefile