summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-01-02 05:34:17 -0300
committerEuAndreh <eu@euandre.org>2024-01-02 05:36:34 -0300
commited7bf08186d83cc82d06ed191fea73e9e18174b2 (patch)
tree4efe745400370207b7de1a9d117bcdac073bee16 /Makefile
parentMakefile: Move manpages and catalog discovery to mkdeps.sh (diff)
downloadpindaiba-ed7bf08186d83cc82d06ed191fea73e9e18174b2.tar.gz
pindaiba-ed7bf08186d83cc82d06ed191fea73e9e18174b2.tar.xz
Makefile: Add support for LLVM fuzzer
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 18 insertions, 1 deletions
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: