aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMaksym Vatsyk <maksym.vatsyk@leviathansecurity.com>2023-12-04 17:21:29 +0100
committerJia Tan <jiat0218@gmail.com>2023-12-07 20:06:54 +0800
commit37581a77ad5a49615325b1d1925fdc402b1e1d5a (patch)
treecf6a59d6611cea18e08b0811557072f7865f7b74 /tests
parentTests: Move common OSS-Fuzz target code to .h file. (diff)
downloadxz-37581a77ad5a49615325b1d1925fdc402b1e1d5a.tar.xz
Tests: Update OSS-Fuzz Makefile.
All .c files can be built as separate fuzz targets. This simplifies the Makefile by allowing us to use wildcards instead of having a Makefile target for each fuzz target.
Diffstat (limited to '')
-rw-r--r--tests/ossfuzz/Makefile13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/ossfuzz/Makefile b/tests/ossfuzz/Makefile
index 747fb662..008cd7df 100644
--- a/tests/ossfuzz/Makefile
+++ b/tests/ossfuzz/Makefile
@@ -1,7 +1,12 @@
-fuzz: fuzz.c
- $(CC) $(CFLAGS) -c fuzz.c -I ../../src/liblzma/api/
- $(CXX) $(CXXFLAGS) $(LIB_FUZZING_ENGINE) fuzz.o -o $(OUT)/fuzz \
- ../../src/liblzma/.libs/liblzma.a
+FUZZ_TARGET_SRCS = $(wildcard *.c)
+FUZZ_TARGET_BINS = $(FUZZ_TARGET_SRCS:.c=)
+
+all: $(FUZZ_TARGET_BINS)
+
+%: %.c
+ $(CC) $(CFLAGS) -c $< -I ../../src/liblzma/api/ ;
+ $(CXX) $(CXXFLAGS) $(LIB_FUZZING_ENGINE) $(<:.c=.o) -o $(OUT)/$@ \
+ ../../src/liblzma/.libs/liblzma.a ;
clean:
rm -f *.o