FUZZ_RULES := $(lastword $(MAKEFILE_LIST))
include $(dir $(FUZZ_RULES))../../src/build.rules

FUZZ_CFLAGS =

ifdef LIBFUZZER
CC ?= clang
#FUZZ_FLAGS ?= -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow
FUZZ_FLAGS ?= -fsanitize=fuzzer,address
ifndef CFLAGS
FUZZ_CFLAGS += $(FUZZ_FLAGS)
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
