mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Stringify the git info passed
avoid escaping the string in the Makefile. Alternative to https://github.com/official-stockfish/Stockfish/pull/4476 closes https://github.com/official-stockfish/Stockfish/pull/4481 No functional change.
This commit is contained in:
parent
c3c46feebb
commit
66bf45b99e
4 changed files with 7 additions and 8 deletions
|
@ -705,13 +705,13 @@ endif
|
||||||
### 3.7.1 Try to include git commit sha for versioning
|
### 3.7.1 Try to include git commit sha for versioning
|
||||||
GIT_SHA = $(shell git rev-parse --short HEAD 2>/dev/null)
|
GIT_SHA = $(shell git rev-parse --short HEAD 2>/dev/null)
|
||||||
ifneq ($(GIT_SHA), )
|
ifneq ($(GIT_SHA), )
|
||||||
CXXFLAGS += -DGIT_SHA=\"$(GIT_SHA)\"
|
CXXFLAGS += -DGIT_SHA=$(GIT_SHA)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### 3.7.2 Try to include git commit date for versioning
|
### 3.7.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
|
||||||
|
|
||||||
### 3.8 Link Time Optimization
|
### 3.8 Link Time Optimization
|
||||||
|
|
|
@ -82,8 +82,6 @@ namespace Eval {
|
||||||
eval_file = EvalFileDefaultName;
|
eval_file = EvalFileDefaultName;
|
||||||
|
|
||||||
#if defined(DEFAULT_NNUE_DIRECTORY)
|
#if defined(DEFAULT_NNUE_DIRECTORY)
|
||||||
#define stringify2(x) #x
|
|
||||||
#define stringify(x) stringify2(x)
|
|
||||||
vector<string> dirs = { "<internal>" , "" , CommandLine::binaryDirectory , stringify(DEFAULT_NNUE_DIRECTORY) };
|
vector<string> dirs = { "<internal>" , "" , CommandLine::binaryDirectory , stringify(DEFAULT_NNUE_DIRECTORY) };
|
||||||
#else
|
#else
|
||||||
vector<string> dirs = { "<internal>" , "" , CommandLine::binaryDirectory };
|
vector<string> dirs = { "<internal>" , "" , CommandLine::binaryDirectory };
|
||||||
|
|
|
@ -160,7 +160,7 @@ string engine_info(bool to_uci) {
|
||||||
{
|
{
|
||||||
ss << "-";
|
ss << "-";
|
||||||
#ifdef GIT_DATE
|
#ifdef GIT_DATE
|
||||||
ss << GIT_DATE;
|
ss << stringify(GIT_DATE);
|
||||||
#else
|
#else
|
||||||
constexpr string_view months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
|
constexpr string_view months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
|
||||||
string month, day, year;
|
string month, day, year;
|
||||||
|
@ -173,7 +173,7 @@ string engine_info(bool to_uci) {
|
||||||
ss << "-";
|
ss << "-";
|
||||||
|
|
||||||
#ifdef GIT_SHA
|
#ifdef GIT_SHA
|
||||||
ss << GIT_SHA;
|
ss << stringify(GIT_SHA);
|
||||||
#else
|
#else
|
||||||
ss << "nogit";
|
ss << "nogit";
|
||||||
#endif
|
#endif
|
||||||
|
@ -190,8 +190,6 @@ string engine_info(bool to_uci) {
|
||||||
|
|
||||||
std::string compiler_info() {
|
std::string compiler_info() {
|
||||||
|
|
||||||
#define stringify2(x) #x
|
|
||||||
#define stringify(x) stringify2(x)
|
|
||||||
#define make_version_string(major, minor, patch) stringify(major) "." stringify(minor) "." stringify(patch)
|
#define make_version_string(major, minor, patch) stringify(major) "." stringify(minor) "." stringify(patch)
|
||||||
|
|
||||||
/// Predefined macros hell:
|
/// Predefined macros hell:
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#define stringify2(x) #x
|
||||||
|
#define stringify(x) stringify2(x)
|
||||||
|
|
||||||
namespace Stockfish {
|
namespace Stockfish {
|
||||||
|
|
||||||
std::string engine_info(bool to_uci = false);
|
std::string engine_info(bool to_uci = false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue