libpsl/fuzz/Makefile.am

100 lines
2.8 KiB
Makefile
Raw Normal View History

AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
2022-01-16 12:59:23 +01:00
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir) -DSRCDIR=\"$(abs_srcdir)\"
#AM_LDFLAGS = -static
LDADD = ../src/libpsl.la $(LIBICU_LIBS) $(LIBIDN_LIBS) $(LIBIDN2_LIBS)
2017-06-09 16:27:37 +02:00
2022-01-16 12:59:23 +01:00
if !FUZZING
MAIN = main.c fuzzer.h
endif
2017-07-13 15:39:46 +02:00
if WITH_LIBICU
XLIBS = $(LIBICU_LIBS)
XTYPE = _icu
2022-01-16 12:59:23 +01:00
libpsl_icu_fuzzer_SOURCES = libpsl_fuzzer.c $(MAIN)
libpsl_icu_load_fuzzer_SOURCES = libpsl_load_fuzzer.c $(MAIN)
libpsl_icu_load_dafsa_fuzzer_SOURCES = libpsl_load_dafsa_fuzzer.c $(MAIN)
2017-07-13 15:39:46 +02:00
PSL_TESTS = \
libpsl_icu_fuzzer$(EXEEXT) \
libpsl_icu_load_fuzzer$(EXEEXT) \
libpsl_icu_load_dafsa_fuzzer$(EXEEXT)
else
if WITH_LIBIDN2
XLIBS = -lidn2 -lunistring
2017-07-13 15:39:46 +02:00
XTYPE = _idn2
2022-01-16 12:59:23 +01:00
libpsl_idn2_fuzzer_SOURCES = libpsl_fuzzer.c $(MAIN)
libpsl_idn2_load_fuzzer_SOURCES = libpsl_load_fuzzer.c $(MAIN)
libpsl_idn2_load_dafsa_fuzzer_SOURCES = libpsl_load_dafsa_fuzzer.c $(MAIN)
2017-07-13 15:39:46 +02:00
PSL_TESTS = \
libpsl_idn2_fuzzer$(EXEEXT) \
libpsl_idn2_load_fuzzer$(EXEEXT) \
libpsl_idn2_load_dafsa_fuzzer$(EXEEXT)
else
if WITH_LIBIDN
XLIBS = -lidn -lunistring
2017-07-13 15:39:46 +02:00
XTYPE = _idn
2022-01-16 12:59:23 +01:00
libpsl_idn_fuzzer_SOURCES = libpsl_fuzzer.c $(MAIN)
libpsl_idn_load_fuzzer_SOURCES = libpsl_load_fuzzer.c $(MAIN)
libpsl_idn_load_dafsa_fuzzer_SOURCES = libpsl_load_dafsa_fuzzer.c $(MAIN)
2017-07-13 15:39:46 +02:00
PSL_TESTS = \
libpsl_idn_fuzzer$(EXEEXT) \
libpsl_idn_load_fuzzer$(EXEEXT) \
libpsl_idn_load_dafsa_fuzzer$(EXEEXT)
else
XLIBS =
XTYPE =
2022-01-16 12:59:23 +01:00
libpsl_fuzzer_SOURCES = libpsl_fuzzer.c $(MAIN)
libpsl_load_fuzzer_SOURCES = libpsl_load_fuzzer.c $(MAIN)
libpsl_load_dafsa_fuzzer_SOURCES = libpsl_load_dafsa_fuzzer.c $(MAIN)
2017-07-13 15:39:46 +02:00
PSL_TESTS = \
libpsl_fuzzer$(EXEEXT) \
libpsl_load_fuzzer$(EXEEXT) \
libpsl_load_dafsa_fuzzer$(EXEEXT)
endif
endif
endif
2017-06-09 16:27:37 +02:00
2022-01-16 12:59:23 +01:00
if FUZZING
bin_PROGRAMS = $(PSL_TESTS)
LDADD += $(LIB_FUZZING_ENGINE)
AM_LDFLAGS = -no-install
else
AM_CPPFLAGS += -DTEST_RUN
AM_TESTS_ENVIRONMENT = export VALGRIND_TESTS"=@VALGRIND_TESTS@";
TESTS = $(PSL_TESTS)
check_PROGRAMS = $(PSL_TESTS)
endif
2017-06-09 16:27:37 +02:00
2019-04-17 12:05:00 +02:00
EXTRA_DIST = meson.build
2017-06-09 16:27:37 +02:00
dist-hook:
find . -name '*.options' -exec cp -v '{}' $(distdir) ';'
find . -name '*.dict' -exec cp -v '{}' $(distdir) ';'
find . -name '*.in' -exec cp -vr '{}' $(distdir) ';'
find . -name '*.repro' -exec cp -vr '{}' $(distdir) ';'
TESTS_ENVIRONMENT = TESTS_VALGRIND="@VALGRIND_ENVIRONMENT@"
clean-local:
2017-07-13 15:39:46 +02:00
rm -rf *.gc?? *.log lcov coverage.info *_fuzzer *.o
2017-06-09 16:27:37 +02:00
fuzz-coverage: $(PSL_TESTS)
find . -name '*_fuzzer' -exec ./coverage.sh '{}' ';'
2022-01-16 12:59:23 +01:00
CXX ?= clang
CXXFLAGS ?= $(CFLAGS)
2017-06-09 16:27:37 +02:00
oss-fuzz:
if test "$$OUT" != ""; then \
for cfile in `ls *_fuzzer.c`; do \
fuzzer="libpsl$(XTYPE)_"$$(basename $$cfile .c|cut -d'_' -f2-); \
$$CXX $$CXXFLAGS $$CPPFLAGS -I$(top_srcdir)/include -I$(top_srcdir) \
"$${cfile}" -o "$${fuzzer}" \
../src/.libs/libpsl.a $${LIB_FUZZING_ENGINE} \
-Wl,-Bstatic \
$(XLIBS) \
2017-06-09 16:27:37 +02:00
-Wl,-Bdynamic; \
done; \
fi
.PHONY: oss-fuzz