Lines Matching +full:force +full:- +full:mode

1 # Detect mingw, since some versions throw a warning with the -fPIC option
2 # (which would be caught as an error in our case with -Werror)
4 MINGW := $(shell $(CROSS_COMPILE)$(CC) -dumpmachine 2>&1 | grep -v mingw)
6 APPLE := $(shell $(CROSS_COMPILE)$(CC) -dumpmachine 2>&1 | grep -v apple)
9 FPIC_CFLAG=-fPIC
11 FPIE_CFLAG=-fPIE
12 FPIE_LDFLAGS=-pie -Wl,-z,relro,-z,now
17 SYS_ROOT_PATH := $(shell xcode-select --print-path)
20 SYS_ROOT := --sysroot=$(SYS_ROOT_PATH)
26 # in conjuction with stack-protector as check functions
28 STACK_PROT_FLAG=-fstack-protector-strong
29 FORTIFY_FLAGS=-D_FORTIFY_SOURCE=2
32 # debug mode, expected word size (16, 32, 64), etc. Those are then used to
37 CLANG := $(shell $(CROSS_COMPILE)$(CC) -v 2>&1 | grep clang)
41 CLANG_VERSION := $(shell $(CROSS_COMPILE)$(CC) -dumpversion)
43 CLANG_VERSION := $(shell echo $(CLANG_VERSION) | cut -f1-2 -d. | sed -e 's/\./*100+/g')
44 # Calculate value - e.g. 1401
47 CLANG_VERSION_GTE_12 := $(shell [ $(CLANG_VERSION) -ge 1200 ] && echo true)
48 CLANG_VERSION_GTE_13 := $(shell [ $(CLANG_VERSION) -ge 1300 ] && echo true)
49 CLANG_VERSION_GTE_16 := $(shell [ $(CLANG_VERSION) -ge 1600 ] && echo true)
50 CLANG_VERSION_GTE_17 := $(shell [ $(CLANG_VERSION) -ge 1700 ] && echo true)
54 # -Werror: treat warnings as errors
56 # Pedantic mode: enable more warnings
57 # -Wshadow: warn the user if a variable declaration shadows one from a parent context
58 # -Wdouble-promotion: warn about implicit conversion from float to double
59 # -Wformat=2: warn about format string vulnerabilities
60 # -fno-common: disallow global variables with same name and type
61 # -Wconversion: warn about implicit conversion
62 # -Wformat-security: warn about format string vulnerabilities
63 WARNING_CFLAGS = -Werror
65 …WARNING_CFLAGS += -Wshadow -Wdouble-promotion -Wformat=2 -fno-common -Wconversion -Wformat-security
69 # -Wno-unused-parameter: commonly a false positive. Functions may be required to have a certain sig…
70 # -Wno-declaration-after-statement: our C standard supports declaration after statements
71 WARNING_CFLAGS += -Wno-unused-parameter -Wno-declaration-after-statement
73 # When compiler is *explicitly* set to clang, use its -Weverything option by
76 # -Wno-reserved-id-macro: our header files use __XXX___ protection macros.
77 # -Wno-padded: padding warnings
78 # -Wno-packed: warning about packed structure we want to keep that way
79 # -Wno-covered-switch-default
80 # -Wno-used-but-marked-unused
83 WARNING_CFLAGS += -Weverything \
84 -Wno-reserved-id-macro -Wno-padded \
85 -Wno-packed -Wno-covered-switch-default \
86 -Wno-used-but-marked-unused -Wno-switch-enum
87 # Add warnings if we are in pedantic mode
89-Walloca -Wcast-qual -Wnull-dereference -Wstack-protector -Wvla -Warray-bounds -Warray-bounds-poin…
93 WARNING_CFLAGS += -Wno-reserved-identifier
99 WARNING_CFLAGS += -Wno-unsafe-buffer-usage
102 WARNING_CFLAGS += -W -Wextra -Wall -Wunreachable-code
103 # Add warnings if we are in pedantic mode
105-Wpedantic -Wformat-overflow=2 -Wformat-truncation=2 -Wnull-dereference -Wstack-protector -Wtrampo…
110 # Sometimes "-Werror" might be too much, this can be overriden
111 WARNING_CFLAGS := $(subst -Werror,,$(WARNING_CFLAGS))
123 CFLAGS ?= $(WARNING_CFLAGS) $(SYS_ROOT) -pedantic -fno-builtin -std=c99 \
124 $(FORTIFY_FLAGS) $(STACK_PROT_FLAG) -O3
135 DEBUG_CFLAGS = -DDEBUG -O -g
138 CFLAGS += -DVERBOSE_INNER_VALUES
149 # Force 64-bit word size
150 64: CFLAGS += -DWORDSIZE=64
152 debug64: CFLAGS += -DWORDSIZE=64 $(DEBUG_CFLAGS)
155 # Force 32-bit word size
156 32: CFLAGS += -DWORDSIZE=32
158 debug32: CFLAGS += -DWORDSIZE=32 $(DEBUG_CFLAGS)
161 # Force 16-bit word size
162 16: CFLAGS += -DWORDSIZE=16
164 debug16: CFLAGS += -DWORDSIZE=16 $(DEBUG_CFLAGS)
167 # Force to compile with 64-bit arch
168 force_arch64: CFLAGS += -m64
171 # Force to compile with 32-bit arch
172 force_arch32: CFLAGS += -m32
177 CFLAGS += -DWITH_STDLIB
185 BIN_CFLAGS ?= $(CFLAGS) $(FPIE_CFLAG) -MMD -MP
186 LIB_CFLAGS ?= $(CFLAGS) $(FPIC_CFLAG) -MMD -MP -ffreestanding
220 LIB_CFLAGS += -I$(LIBECC_INCLUDE_FOLDER)
221 BIN_CFLAGS += -I$(LIBECC_INCLUDE_FOLDER)
236 LIB_DYN_LDFLAGS ?= -shared -Wl,-undefined,dynamic_lookup
238 LIB_DYN_LDFLAGS ?= -shared -Wl,-z,relro,-z,now
244 CFLAGS += -DUSE_SIG_BLINDING
252 CFLAGS += -DNO_USE_COMPLETE_FORMULAS
255 # Force Double and Add always usage
257 CFLAGS += -DUSE_DOUBLE_ADD_ALWAYS
260 CFLAGS += -DUSE_MONTY_LADDER
263 # Force Montgomery Ladder always usage
265 CFLAGS += -DUSE_MONTY_LADDER
268 CFLAGS += -DUSE_DOUBLE_ADD_ALWAYS
271 # Force small stack usage
273 CFLAGS += -DUSE_SMALL_STACK
279 CFLAGS += -DNO_KNOWN_VECTORS
285 # mode!
287 CFLAGS += -DUSE_CRYPTOFUZZ
291 CFLAGS += -DUSE_ASSERT_PRINT
297 CFLAGS += -DUSE_WARN_UNUSED_RET
302 CFLAGS += -fsanitize=undefined -fsanitize=address -fsanitize=leak
304 # Clang version < 12 do not support unsigned-shift-base
306 …CFLAGS += -fsanitize=integer -fno-sanitize=unsigned-integer-overflow -fno-sanitize=unsigned-shift-
311 # Do we want to use the ISO14888-3 version of the
315 CFLAGS += -DUSE_ISO14888_3_ECRDSA
319 GPP := $(shell $(CROSS_COMPILE)$(CC) -v 2>&1 | grep g++)
324 CFLAGS := $(patsubst -std=c99, -std=c++2a, $(CFLAGS))
325 CFLAGS += -Wno-deprecated
327 CFLAGS := $(patsubst -Wstrict-prototypes,,$(CFLAGS))
328 CFLAGS := $(patsubst -Wjump-misses-init,,$(CFLAGS))
329 CFLAGS := $(patsubst -Wduplicated-branches,,$(CFLAGS))
330 CFLAGS := $(patsubst -Wno-declaration-after-statement,,$(CFLAGS))
334 CFLAGS := $(patsubst -std=c99, -std=c++2a, $(CFLAGS))
335 …FLAGS += -Wno-deprecated -Wno-c++98-c++11-c++14-c++17-compat-pedantic -Wno-old-style-cast -Wno-zer…
347 CFLAGS += -DWITH_OPENMP_SELF_TESTS -fopenmp
348 LDFLAGS += -fopenmp