mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Makefile: Extend sanitize support
Enable compiling with multiple sanitizers at once. Syntax: make build ARCH=x86-64-avx512 debug=on sanitize="address undefined" closes https://github.com/official-stockfish/Stockfish/pull/3524 No functional change.
This commit is contained in:
parent
98cbaa6c6b
commit
3802cdf9b6
1 changed files with 12 additions and 7 deletions
17
src/Makefile
17
src/Makefile
|
@ -61,9 +61,11 @@ endif
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode
|
# debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode
|
||||||
# sanitize = undefined/thread/no (-fsanitize )
|
# sanitize = none/<sanitizer> ... (-fsanitize )
|
||||||
# --- ( undefined ) --- enable undefined behavior checks
|
# --- ( undefined ) --- enable undefined behavior checks
|
||||||
# --- ( thread ) --- enable threading error checks
|
# --- ( thread ) --- enable threading error checks
|
||||||
|
# --- ( address ) --- enable memory access checks
|
||||||
|
# --- ...etc... --- see compiler documentation for supported sanitizers
|
||||||
# optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations
|
# optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations
|
||||||
# arch = (name) --- (-arch) --- Target architecture
|
# arch = (name) --- (-arch) --- Target architecture
|
||||||
# bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system
|
# bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system
|
||||||
|
@ -84,6 +86,10 @@ endif
|
||||||
# Note that Makefile is space sensitive, so when adding new architectures
|
# Note that Makefile is space sensitive, so when adding new architectures
|
||||||
# or modifying existing flags, you have to make sure there are no extra spaces
|
# or modifying existing flags, you have to make sure there are no extra spaces
|
||||||
# at the end of the line for flag values.
|
# at the end of the line for flag values.
|
||||||
|
#
|
||||||
|
# Example of use for these flags:
|
||||||
|
# make build ARCH=x86-64-avx512 debug=on sanitize="address undefined"
|
||||||
|
|
||||||
|
|
||||||
### 2.1. General and architecture defaults
|
### 2.1. General and architecture defaults
|
||||||
|
|
||||||
|
@ -105,7 +111,7 @@ endif
|
||||||
|
|
||||||
optimize = yes
|
optimize = yes
|
||||||
debug = no
|
debug = no
|
||||||
sanitize = no
|
sanitize = none
|
||||||
bits = 64
|
bits = 64
|
||||||
prefetch = no
|
prefetch = no
|
||||||
popcnt = no
|
popcnt = no
|
||||||
|
@ -473,9 +479,9 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### 3.2.2 Debugging with undefined behavior sanitizers
|
### 3.2.2 Debugging with undefined behavior sanitizers
|
||||||
ifneq ($(sanitize),no)
|
ifneq ($(sanitize),none)
|
||||||
CXXFLAGS += -g3 -fsanitize=$(sanitize)
|
CXXFLAGS += -g3 $(addprefix -fsanitize=,$(sanitize))
|
||||||
LDFLAGS += -fsanitize=$(sanitize)
|
LDFLAGS += $(addprefix -fsanitize=,$(sanitize))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### 3.3 Optimization
|
### 3.3 Optimization
|
||||||
|
@ -838,7 +844,6 @@ config-sanity: net
|
||||||
@echo "Testing config sanity. If this fails, try 'make help' ..."
|
@echo "Testing config sanity. If this fails, try 'make help' ..."
|
||||||
@echo ""
|
@echo ""
|
||||||
@test "$(debug)" = "yes" || test "$(debug)" = "no"
|
@test "$(debug)" = "yes" || test "$(debug)" = "no"
|
||||||
@test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "address" || test "$(sanitize)" = "no"
|
|
||||||
@test "$(optimize)" = "yes" || test "$(optimize)" = "no"
|
@test "$(optimize)" = "yes" || test "$(optimize)" = "no"
|
||||||
@test "$(SUPPORTED_ARCH)" = "true"
|
@test "$(SUPPORTED_ARCH)" = "true"
|
||||||
@test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
|
@test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
|
||||||
|
|
Loading…
Add table
Reference in a new issue