1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

use expanded variables for shell commands

Performance improvement for the shell commands in the Makefile.
By using expanded variables, the shell commands are only
evaluated once, instead of every time they are used.

closes https://github.com/official-stockfish/Stockfish/pull/4838

No functional change
This commit is contained in:
Disservin 2023-10-22 16:43:33 +02:00
parent 40c6a84434
commit b187622233

View file

@ -20,9 +20,9 @@
### ========================================================================== ### ==========================================================================
### Establish the operating system name ### Establish the operating system name
KERNEL = $(shell uname -s) KERNEL := $(shell uname -s)
ifeq ($(KERNEL),Linux) ifeq ($(KERNEL),Linux)
OS = $(shell uname -o) OS := $(shell uname -o)
endif endif
### Target Windows OS ### Target Windows OS
@ -33,7 +33,7 @@ ifeq ($(OS),Windows_NT)
else ifeq ($(COMP),mingw) else ifeq ($(COMP),mingw)
target_windows = yes target_windows = yes
ifeq ($(WINE_PATH),) ifeq ($(WINE_PATH),)
WINE_PATH = $(shell which wine) WINE_PATH := $(shell which wine)
endif endif
endif endif
@ -116,7 +116,7 @@ ifeq ($(ARCH),)
endif endif
ifeq ($(ARCH), native) ifeq ($(ARCH), native)
override ARCH = $(shell $(SHELL) ../scripts/get_native_properties.sh | cut -d " " -f 1) override ARCH := $(shell $(SHELL) ../scripts/get_native_properties.sh | cut -d " " -f 1)
endif endif
# explicitly check for the list of supported architectures (as listed with make help), # explicitly check for the list of supported architectures (as listed with make help),
@ -542,8 +542,8 @@ endif
### Sometimes gcc is really clang ### Sometimes gcc is really clang
ifeq ($(COMP),gcc) ifeq ($(COMP),gcc)
gccversion = $(shell $(CXX) --version 2>/dev/null) gccversion := $(shell $(CXX) --version 2>/dev/null)
gccisclang = $(findstring clang,$(gccversion)) gccisclang := $(findstring clang,$(gccversion))
ifneq ($(gccisclang),) ifneq ($(gccisclang),)
profile_make = clang-profile-make profile_make = clang-profile-make
profile_use = clang-profile-use profile_use = clang-profile-use
@ -601,7 +601,7 @@ ifeq ($(optimize),yes)
endif endif
ifeq ($(comp),clang) ifeq ($(comp),clang)
clangmajorversion = $(shell $(CXX) -dumpversion 2>/dev/null | cut -f1 -d.) clangmajorversion := $(shell $(CXX) -dumpversion 2>/dev/null | cut -f1 -d.)
ifeq ($(shell expr $(clangmajorversion) \< 16),1) ifeq ($(shell expr $(clangmajorversion) \< 16),1)
CXXFLAGS += -fexperimental-new-pass-manager CXXFLAGS += -fexperimental-new-pass-manager
endif endif
@ -717,13 +717,13 @@ ifeq ($(pext),yes)
endif endif
### 3.8.1 Try to include git commit sha for versioning ### 3.8.1 Try to include git commit sha for versioning
GIT_SHA = $(shell git rev-parse HEAD 2>/dev/null | cut -c 1-8) GIT_SHA := $(shell git rev-parse HEAD 2>/dev/null | cut -c 1-8)
ifneq ($(GIT_SHA), ) ifneq ($(GIT_SHA), )
CXXFLAGS += -DGIT_SHA=$(GIT_SHA) CXXFLAGS += -DGIT_SHA=$(GIT_SHA)
endif endif
### 3.8.2 Try to include git commit date for versioning ### 3.8.2 Try to include git commit date for versioning
GIT_DATE = $(shell git show -s --date=format:'%Y%m%d' --format=%cd HEAD 2>/dev/null) GIT_DATE := $(shell git show -s --date=format:'%Y%m%d' --format=%cd HEAD 2>/dev/null)
ifneq ($(GIT_DATE), ) ifneq ($(GIT_DATE), )
CXXFLAGS += -DGIT_DATE=$(GIT_DATE) CXXFLAGS += -DGIT_DATE=$(GIT_DATE)
endif endif