From fc1167fd345ff6f767fd73d1f1053381b68f18a7 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 15 Feb 2023 08:26:52 +0000 Subject: [PATCH] common.mak: avoid a lot of warnings if `make --warn` is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following warnings by using proper default values: ../common.mak:1: warning: undefined variable 'COMMON_INCLUDED' ../common.mak:87: warning: undefined variable 'V' ../common.mak:95: warning: undefined variable 'W' ../common.mak:98: warning: undefined variable 'D' ../common.mak:107: warning: undefined variable 'ASAN' ../common.mak:249: warning: undefined variable 'OPT_FLAGS' ../common.mak:262: warning: undefined variable 'G' ../common.mak:280: warning: undefined variable 'C' ../common.mak:349: warning: undefined variable 'MAKECMDGOALS' ../common.mak:105: warning: undefined variable 'ENABLE_WERROR' This has two main advantages: 1. Explicit default values 2. `make --warn` shows less false positives Reviewed-by: Jan Höppner Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- common.mak | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/common.mak b/common.mak index 8ed7c531..e3a5e217 100644 --- a/common.mak +++ b/common.mak @@ -1,5 +1,16 @@ -ifndef $(COMMON_INCLUDED) -COMMON_INCLUDED = true +COMMON_INCLUDED ?= false +V ?= 0 +W ?= 0 +G ?= 0 +C ?= 0 +D ?= 0 +ASAN ?= 0 +ENABLE_WERROR ?= 0 +OPT_FLAGS ?= +MAKECMDGOALS ?= + +ifeq ($(COMMON_INCLUDED),false) +COMMON_INCLUDED := true # Global definitions # The variable "DISTRELEASE" should be overwritten in rpm spec files with: