summaryrefslogtreecommitdiffstats
path: root/Makefile_util.am
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2022-05-14 23:11:33 +0200
committerOneric <oneric@oneric.stub>2022-07-03 16:19:09 +0200
commita9d5901c59eb668a72b522d7fe19b6389d27ece8 (patch)
tree36070a7f68b6cabf5f37d2e8dcbd815a84465de4 /Makefile_util.am
parent83a700e5c72babc0233f07a249837627f3c8c51f (diff)
downloadlibass-a9d5901c59eb668a72b522d7fe19b6389d27ece8.tar.bz2
libass-a9d5901c59eb668a72b522d7fe19b6389d27ece8.tar.xz
fuzz: add OSS-Fuzz build target
OSS-Fuzz requires linking with it's C++ clang++ specifically, due to using sanitizer link options failing with C clang. While it would be possible to more generally allow setting a custom linker for building the fuzz program, this wouldn't be much cleaner and would likely introduce all sort of problems due to the (un)intended interactions with default linkflags and libtool. And if we only want it to be good enough for OSS-Fuzzz, we might as well just make it actually OSS-Fuzz specific. This will also allow us to push many changes and fixes to the fuzzer without having to go through OSS-Fuzz repository and its Google-account-bound CLA.
Diffstat (limited to 'Makefile_util.am')
-rw-r--r--Makefile_util.am11
1 files changed, 11 insertions, 0 deletions
diff --git a/Makefile_util.am b/Makefile_util.am
index be1cf880..c86220fc 100644
--- a/Makefile_util.am
+++ b/Makefile_util.am
@@ -29,3 +29,14 @@ fuzz_fuzz_SOURCES = fuzz/fuzz.c
fuzz_fuzz_CPPFLAGS = -I$(top_srcdir)/libass $(FUZZ_CPPFLAGS)
fuzz_fuzz_LDADD = libass/libass.la
fuzz_fuzz_LDFLAGS = $(AM_LDFLAGS) $(FUZZ_LDFLAGS) -static
+
+if ENABLE_FUZZ
+fuzz/fuzz_ossfuzz: fuzz/fuzz-fuzz.o libass/libass.la $(srcdir)/libass.pc
+ $$CXX $$CXXFLAGS -std=c++11 \
+ -o $@ \
+ fuzz/fuzz-fuzz.o \
+ $$LIB_FUZZING_ENGINE libass/.libs/libass.a \
+ -Wl,-Bstatic \
+ $$(pkg-config --static --libs $(srcdir)/libass.pc | sed -e 's/-lm //g' -e 's/-lass //g') \
+ -Wl,-Bdynamic
+endif