aboutsummaryrefslogtreecommitdiff
path: root/fuzz/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/Makefile')
-rw-r--r--fuzz/Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/fuzz/Makefile b/fuzz/Makefile
new file mode 100644
index 0000000..66037a2
--- /dev/null
+++ b/fuzz/Makefile
@@ -0,0 +1,28 @@
+-include ../../config.mk
+
+ALL = text-fuzzer
+CC = afl-gcc
+CFLAGS += -I. -I../.. -DBUFFER_SIZE=4 -DBLOCK_SIZE=4
+
+test: $(ALL)
+
+text-fuzzer: text-fuzzer.c fuzzer.h ../../text.c ../../text-util.c ../../text-motions.c ../../text-objects.c ../../text-regex.c
+ @echo Compiling $@ binary
+ ${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_EXTRA} ${filter %.c, $^} ${LDFLAGS} -o $@
+
+debug: clean
+ $(MAKE) CFLAGS_EXTRA='${CFLAGS_EXTRA} ${CFLAGS_DEBUG}'
+
+afl-fuzz-text: text-fuzzer
+ @mkdir -p "results/$<"
+ @afl-fuzz -i - -x "dictionaries/$<.dict" -o "results/$<" -- "./$<" || \
+ afl-fuzz -i "inputs/$<" -x "dictionaries/$<.dict" -o "results/$<" -- "./$<"
+
+clean:
+ @echo cleaning
+ @rm -f $(ALL)
+
+distclean: clean
+ @rm -rf results/
+
+.PHONY: clean distclean debug afl-fuzz-text