diff options
author | EuAndreh <eu@euandre.org> | 2024-01-02 05:34:17 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-01-02 05:36:34 -0300 |
commit | ed7bf08186d83cc82d06ed191fea73e9e18174b2 (patch) | |
tree | 4efe745400370207b7de1a9d117bcdac073bee16 | |
parent | Makefile: Move manpages and catalog discovery to mkdeps.sh (diff) | |
download | pindaiba-ed7bf08186d83cc82d06ed191fea73e9e18174b2.tar.gz pindaiba-ed7bf08186d83cc82d06ed191fea73e9e18174b2.tar.xz |
Makefile: Add support for LLVM fuzzer
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile | 19 | ||||
-rw-r--r-- | deps.mk | 10 | ||||
-rwxr-xr-x | mkdeps.sh | 9 |
4 files changed, 40 insertions, 3 deletions
@@ -7,5 +7,8 @@ /src/*.c.txt /src/*.cat /doc/*.[0-9] -/tests/slurp.o +/tests/fuzz/*.o +/tests/fuzz/*.xa +/tests/fuzz/*.bin /tests/fuzz/corpus/ +/tests/slurp.o @@ -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: @@ -11,6 +11,16 @@ manpages.in = $(manpages.en.in) catalogs.en.msg = src/pindaiba.en.msg catalogs.msg = $(catalogs.en.msg) +fuzz.c = \ + tests/fuzz/another.c \ + tests/fuzz/hello.c \ + +tests/fuzz/another.xa: tests/fuzz/another.o +tests/fuzz/hello.xa: tests/fuzz/hello.o +tests/fuzz/another.bin-check: tests/fuzz/another.bin +tests/fuzz/hello.bin-check: tests/fuzz/hello.bin + + sources.c = \ src/catalog.c \ src/hash.c \ @@ -12,10 +12,17 @@ cfiles() { } export LANG=POSIX.UTF-8 + find doc/*.en.*.in 2>/dev/null | sort | varlist 'manpages.en.in' ||: echo 'manpages.in = $(manpages.en.in)' printf 'catalogs.en.msg = %s\n' "$(find src/ -name '*.msg')" echo 'catalogs.msg = $(catalogs.en.msg)' -echo '' +printf '\n' + +find tests/fuzz/*.c | sort | varlist 'fuzz.c' +find tests/fuzz/*.c | sort | awk -F. '{ printf "%s.xa: %s.o\n", $1, $1 }' +find tests/fuzz/*.c | sort | awk -F. '{ printf "%s.bin-check: %s.bin\n", $1, $1 }' +printf '\n\n' + cfiles | varlist 'sources.c' ldev deps $(cfiles) |