hostapd/tests/fuzzing/rules.include
Jouni Malinen 2e840fb2ab tests: Fix CC and CFLAGS default processing for fuzzing
"make LIBFUZZER=y" was supposed to set CC and CFLAGS to working values
by default if not overridden by something external. That did not seem to
work since the defaults from the other build system components ended up
setting these variables before the checks here. Fix this by replacing
the known default values for non-fuzzing builds.

Signed-off-by: Jouni Malinen <j@w1.fi>
2022-11-06 17:11:47 +02:00

38 lines
797 B
Text

FUZZ_RULES := $(lastword $(MAKEFILE_LIST))
include $(dir $(FUZZ_RULES))../../src/build.rules
FUZZ_CFLAGS =
ifdef LIBFUZZER
CC ?= clang
ifeq ($(CC),cc)
CC = clang
endif
#FUZZ_FLAGS ?= -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow
FUZZ_FLAGS ?= -fsanitize=fuzzer,address
ifndef CFLAGS
FUZZ_CFLAGS += $(FUZZ_FLAGS)
else
ifeq ($(CFLAGS),-MMD -O2 -Wall -g)
FUZZ_CFLAGS += $(FUZZ_FLAGS)
endif
endif
endif
FUZZ_CFLAGS += -DCONFIG_NO_RANDOM_POOL -DTEST_FUZZ
export FUZZ_CFLAGS
CFLAGS ?= -MMD -O2 -Wall -g
CFLAGS += $(FUZZ_CFLAGS)
ifdef LIBFUZZER
CFLAGS += -DTEST_LIBFUZZER
LDFLAGS += $(FUZZ_FLAGS)
endif
WPAS_SRC=../../../wpa_supplicant
SRC=../../../src
CFLAGS += -I$(SRC) -I$(SRC)/utils -I$(WPAS_SRC)
OBJS += ../fuzzer-common.o
# for the lib builds
export TEST_FUZZ=y