From 6ede1bed89fd9d1c25cc6349722898f084bf5e15 Mon Sep 17 00:00:00 2001 From: proukornew Date: Fri, 17 Dec 2021 00:41:29 +0300 Subject: [PATCH] Improve handling of variables set in the make environment removes duplication on the commandline for example in a profile-build closes https://github.com/official-stockfish/Stockfish/pull/3859 No functional change --- src/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index cc9b4201..ff2452d6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -345,9 +345,15 @@ endif ### ========================================================================== ### 3.1 Selecting compiler (default = gcc) -CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS) -DEPENDFLAGS += -std=c++17 -LDFLAGS += $(EXTRALDFLAGS) +ifeq ($(MAKELEVEL),0) + export ENV_CXXFLAGS := $(CXXFLAGS) + export ENV_DEPENDFLAGS := $(DEPENDFLAGS) + export ENV_LDFLAGS := $(LDFLAGS) +endif + +CXXFLAGS = $(ENV_CXXFLAGS) -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS) +DEPENDFLAGS = $(ENV_DEPENDFLAGS) -std=c++17 +LDFLAGS = $(ENV_LDFLAGS) $(EXTRALDFLAGS) ifeq ($(COMP),) COMP=gcc