1# 2# Copyright 2019 Google LLC. All Rights Reserved. 3# Copyright 2017-2018 Nest Labs Inc. All Rights Reserved. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17 18# 19# Description: 20# This file is a make "header" or pre make header that defines 21# make macros for controlling build verbosity. 22# 23 24# 25# Verbosity 26# 27 28# The default build verbosity is 0 or none. Invoking 'make V=0' is 29# equivalent to 'make' with this default. 30 31NL_DEFAULT_VERBOSITY ?= 0 32 33# Alias for the command echo suppression marker. 34 35NL_AT := @ 36 37# Alias for a conditional command echo suppression marker, conditioned 38# on the build verbosity. 39 40NL_V_AT = $(NL_V_AT_$(V)) 41NL_V_AT_ = $(NL_V_AT_$(NL_DEFAULT_VERBOSITY)) 42NL_V_AT_0 = $(NL_AT) 43NL_V_AT_1 = 44 45# 46# Verbosity Build Progress Macros 47# 48 49# Macro for emitting "<ACTION> <target | output>" oneline, succinct 50# build progress messages. 51 52_NL_PROGRESS := printf " %-13s %s\n" 53NL_PROGRESS := $(NL_AT)$(_NL_PROGRESS) 54 55# Macro for emitting "<ACTION> <target | output>" oneline, succinct 56# build progress messages, conditioned on build verbosity. 57 58NL_V_PROGRESS = $(NL_V_PROGRESS_$(V)) 59NL_V_PROGRESS_ = $(NL_V_PROGRESS_$(NL_DEFAULT_VERBOSITY)) 60NL_V_PROGRESS_0 = $(NL_PROGRESS) 61NL_V_PROGRESS_1 = $(NL_AT)true 62 63# Common convenience progress message macros, conditioned on build 64# verbosity. 65 66NL_V_PROGRESS_BOOTSTRAP = $(NL_V_PROGRESS) "BOOTSTRAP" "$(1)"; 67NL_V_PROGRESS_BOOTSTRAP_ALL = $(NL_V_BOOTSTRAP) "all"; 68NL_V_PROGRESS_BOOTSTRAP_CONFIG = $(NL_V_BOOTSTRAP) "config"; 69NL_V_PROGRESS_BOOTSTRAP_MAKE = $(NL_V_BOOTSTRAP) "make"; 70 71NL_V_PROGRESS_CONFIGURE = $(NL_V_PROGRESS) "CONFIGURE" 72 73NL_V_PROGRESS_GIT_INIT = $(NL_V_PROGRESS) "GIT INIT" "$(@)"; 74 75NL_V_PROGRESS_MAKE = $(NL_V_PROGRESS) "MAKE" "$(@)"; 76 77NL_V_PROGRESS_LN_S = $(NL_V_PROGRESS) "LN" "$(@)"; 78 79NL_V_PROGRESS_MKDIR = $(NL_V_PROGRESS) "MKDIR" "$(1)"; 80NL_V_PROGRESS_MKDIR_P = $(NL_V_MKDIR) 81NL_V_PROGRESS_RMDIR = $(NL_V_PROGRESS) "RMDIR" "$(1)"; 82 83NL_V_PROGRESS_GZIP = $(NL_V_PROGRESS) "GZIP" "$(@)"; 84NL_V_PROGRESS_TAR = $(NL_V_PROGRESS) "TAR" "$(@)"; 85NL_V_PROGRESS_TGZ = $(NL_V_PROGRESS) "TGZ" "$(@)"; 86NL_V_PROGRESS_TXZ = $(NL_V_PROGRESS) "TXZ" "$(@)"; 87NL_V_PROGRESS_XZ = $(NL_V_PROGRESS) "XZ" "$(@)"; 88 89# 90# Verbosity Commands and Flags 91# 92 93# This is useful when we do not want submake to be chatty about what 94# it doing when verbosity is suppressed. However, when verbosity is 95# requested, -s (silent) would otherwise suppress all make verbose 96# output. Consequently, suppress -s when verbosity is requested. 97 98NL_V_MAKE_S = $(NL_V_MAKE_S_$(V)) 99NL_V_MAKE_S_ = $(NL_V_MAKE_S_$(NL_DEFAULT_VERBOSITY)) 100NL_V_MAKE_S_0 = $(MAKE) -s 101NL_V_MAKE_S_1 = $(MAKE) 102