diff --git a/GNUmakefile b/GNUmakefile index 6fee54d3..3ee9a812 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -119,9 +119,10 @@ else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim) DETECT_FEATURES := 0 endif -# Strip out -Wall, -Wextra and friends for feature testing +# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed +# because it requires -O1 or higher, but we use -O0 to tame the optimizer. ifeq ($(DETECT_FEATURES),1) - TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=1 -D_FORTIFY_SOURCE=2 -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) + TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) ifneq ($(strip $(TCXXFLAGS)),) $(info Using testing flags: $(TCXXFLAGS)) endif diff --git a/GNUmakefile-cross b/GNUmakefile-cross index d32139ed..a6585253 100755 --- a/GNUmakefile-cross +++ b/GNUmakefile-cross @@ -192,9 +192,10 @@ else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim) DETECT_FEATURES := 0 endif -# Strip out -Wall, -Wextra and friends for feature testing +# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed +# because it requires -O1 or higher, but we use -O0 to tame the optimizer. ifeq ($(DETECT_FEATURES),1) - TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=1 -D_FORTIFY_SOURCE=2 -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) + TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) ifneq ($(strip $(TCXXFLAGS)),) $(info Using testing flags: $(TCXXFLAGS)) endif