From ed7bf08186d83cc82d06ed191fea73e9e18174b2 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 2 Jan 2024 05:34:17 -0300 Subject: Makefile: Add support for LLVM fuzzer --- Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 79eda83..45fe1a2 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,9 @@ sources.o = $(sources.c:.c=.o) sources.to = $(sources.c:.c=.to) sources.xa = $(sources.c:.c=.xa) sources.bin = $(sources.c:.c=.bin) +fuzz.o = $(fuzz.c:.c=.o) +fuzz.xa = $(fuzz.c:.c=.xa) +fuzz.bin = $(fuzz.c:.c=.bin) sources = \ $(sources.c) \ @@ -79,6 +82,9 @@ derived-assets = \ src/main.bin \ side-assets = \ + $(fuzz.o) \ + $(fuzz.xa) \ + $(fuzz.bin) \ src/logerr.c.txt \ src/catalog.c.txt \ @@ -91,12 +97,13 @@ all: $(derived-assets) lib$(NAME).a: $(sources.o) src/main.xa: $(sources.o) src/main.o +$(fuzz.bin): lib$(NAME).a $(manpages) src/config.h: Makefile deps.mk $(sources.o) $(sources.to): src/config.h Makefile deps.mk tests/slurp.o: src/config.h Makefile deps.mk -lib$(NAME).a $(sources.xa) src/main.xa: +lib$(NAME).a $(sources.xa) src/main.xa $(fuzz.xa): $(AR) $(ARFLAGS) $@ $? src/$(NAME).en.cat: src/i18n.bin @@ -125,6 +132,16 @@ check-unit: $(sources.bin-check) check: check-unit + +fuzz.bin-check = $(fuzz.c:.c=.bin-check) +$(fuzz.bin-check): + $(EXEC)$*.bin tests/fuzz/corpus/ $(FUZZFLAGS) + +## Run fuzzing targets indefinitely. +fuzz: $(fuzz.bin-check) + + + ## Remove *all* derived artifacts produced during the build. ## A dedicated test asserts that this is always true. clean: -- cgit v1.2.3