Blame fuzz/Makefile.am

Packit Service 4684c1
AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) -Wno-unused-parameter -Wno-pedantic
Packit Service 4684c1
AM_CPPFLAGS = -I$(top_srcdir)/lib/includes -I$(top_builddir)/lib/includes -I$(srcdir) \
Packit Service 4684c1
 -DSRCDIR=\"$(abs_srcdir)\" -DTEST_RUN
Packit Service 4684c1
Packit Service 4684c1
LDADD = ../gl/libgnu.la ../lib/libgnutls.la \
Packit Service 4684c1
 $(LIBOBJS) $(GETADDRINFO_LIB) $(HOSTENT_LIB) $(INET_NTOP_LIB)\
Packit Service 4684c1
 $(LIBSOCKET) $(LIB_CLOCK_GETTIME) $(LIB_NANOSLEEP) $(LIB_POLL) $(LIB_PTHREAD)\
Packit Service 4684c1
 $(LIB_SELECT) $(LIBTHREAD) $(SERVENT_LIB) \
Packit Service 4684c1
 $(LIBS)
Packit Service 4684c1
Packit Service 4684c1
FUZZERS = \
Packit Service 4684c1
 gnutls_x509_verify_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_base64_decoder_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_base64_encoder_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_client_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_client_rawpk_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_dn_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_idna_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_ocsp_req_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_ocsp_resp_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_pkcs12_key_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_pkcs7_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_pkcs8_key_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_private_key_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_psk_client_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_psk_server_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_reverse_idna_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_server_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_server_rawpk_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_srp_client_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_srp_server_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_set_trust_file_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_x509_crl_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_x509_crq_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_x509_parser_fuzzer$(EXEEXT) \
Packit Service 4684c1
 gnutls_ext_raw_parse_fuzzer$(EXEEXT)
Packit Service 4684c1
Packit Service 4684c1
check_PROGRAMS = $(FUZZERS)
Packit Service 4684c1
Packit Service 4684c1
COMMON_SOURCES = main.c fuzzer.h
Packit Service 4684c1
gnutls_x509_verify_fuzzer_SOURCES = gnutls_x509_verify_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_base64_decoder_fuzzer_SOURCES = gnutls_base64_decoder_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_base64_encoder_fuzzer_SOURCES = gnutls_base64_encoder_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_client_fuzzer_SOURCES = gnutls_client_fuzzer.c $(COMMON_SOURCES) mem.h certs.h
Packit Service 4684c1
gnutls_client_rawpk_fuzzer_SOURCES = gnutls_client_rawpk_fuzzer.c $(COMMON_SOURCES) mem.h certs.h
Packit Service 4684c1
gnutls_dn_parser_fuzzer_SOURCES = gnutls_dn_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_idna_parser_fuzzer_SOURCES = gnutls_idna_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_ocsp_req_parser_fuzzer_SOURCES = gnutls_ocsp_req_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_ocsp_resp_parser_fuzzer_SOURCES = gnutls_ocsp_resp_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_pkcs12_key_parser_fuzzer_SOURCES = gnutls_pkcs12_key_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_pkcs7_parser_fuzzer_SOURCES = gnutls_pkcs7_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_pkcs8_key_parser_fuzzer_SOURCES = gnutls_pkcs8_key_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_private_key_parser_fuzzer_SOURCES = gnutls_private_key_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_psk_client_fuzzer_SOURCES = gnutls_psk_client_fuzzer.c $(COMMON_SOURCES) mem.h psk.h
Packit Service 4684c1
gnutls_psk_server_fuzzer_SOURCES = gnutls_psk_server_fuzzer.c $(COMMON_SOURCES) mem.h psk.h
Packit Service 4684c1
gnutls_reverse_idna_parser_fuzzer_SOURCES = gnutls_reverse_idna_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_server_fuzzer_SOURCES = gnutls_server_fuzzer.c $(COMMON_SOURCES) mem.h certs.h
Packit Service 4684c1
gnutls_server_rawpk_fuzzer_SOURCES = gnutls_server_rawpk_fuzzer.c $(COMMON_SOURCES) mem.h certs.h
Packit Service 4684c1
gnutls_srp_client_fuzzer_SOURCES = gnutls_srp_client_fuzzer.c $(COMMON_SOURCES) mem.h srp.h
Packit Service 4684c1
gnutls_srp_server_fuzzer_SOURCES = gnutls_srp_server_fuzzer.c $(COMMON_SOURCES) mem.h srp.h
Packit Service 4684c1
gnutls_set_trust_file_fuzzer_SOURCES = gnutls_set_trust_file_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_x509_crl_parser_fuzzer_SOURCES = gnutls_x509_crq_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_x509_crq_parser_fuzzer_SOURCES = gnutls_x509_crq_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_x509_parser_fuzzer_SOURCES = gnutls_x509_parser_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
gnutls_ext_raw_parse_fuzzer_SOURCES = gnutls_ext_raw_parse_fuzzer.c $(COMMON_SOURCES)
Packit Service 4684c1
Packit Service 4684c1
gnutls_set_trust_file_fuzzer_LDADD = $(LDADD) $(LIBDL)
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
#EXTRA_DIST = $(wildcard *.options) $(wildcard *.dict) \
Packit Service 4684c1
# $(wildcard *.in) $(wildcard *.repro)
Packit Service 4684c1
Packit Service 4684c1
# We don't include the fuzz corpora into the tarball.
Packit Service 4684c1
# Testing the corpora during dev cycles and in the CI is enough.
Packit Service 4684c1
dist-hook:
Packit Service 4684c1
	find . -name '*.options' -exec cp -v '{}' $(distdir) ';'
Packit Service 4684c1
	find . -name '*.dict' -exec cp -v '{}' $(distdir) ';'
Packit Service 4684c1
#	find . -name '*.in' -exec cp -vr '{}' $(distdir) ';'
Packit Service 4684c1
	find . -name '*.repro' -exec cp -vr '{}' $(distdir) ';'
Packit Service 4684c1
Packit Service 4684c1
TESTS = $(FUZZERS)
Packit Service 4684c1
Packit Service 4684c1
clean-local:
Packit Service 4684c1
	rm -rf *.gc?? *.log lcov
Packit Service 4684c1
Packit Service 4684c1
oss-fuzz:
Packit Service 4684c1
	if test "$$OUT" != ""; then \
Packit Service 4684c1
	for ccfile in *_fuzzer.c; do \
Packit Service 4684c1
	fuzzer=$$(basename $$ccfile .c); \
Packit Service 4684c1
	XLIBS="-lhogweed -lnettle -ltasn1 -lgmp -lidn2 -lunistring"; \
Packit Service 4684c1
	$$CC $$CFLAGS -I$(top_srcdir)/lib/includes/ -I$(top_srcdir) \
Packit Service 4684c1
	-c "$${fuzzer}.c" -o "$${fuzzer}.o" ; \
Packit Service 4684c1
	$$CXX $$CXXFLAGS "$${fuzzer}.o" -o "$${fuzzer}" \
Packit Service 4684c1
	../lib/.libs/libgnutls.a $${LIB_FUZZING_ENGINE} \
Packit Service 4684c1
	-Wl,-Bstatic \
Packit Service 4684c1
	$${XLIBS} \
Packit Service 4684c1
	-Wl,-Bdynamic || exit $?; \
Packit Service 4684c1
	done; \
Packit Service 4684c1
	fi
Packit Service 4684c1
Packit Service 4684c1
.PHONY: oss-fuzz
Packit Service 4684c1
Packit Service 4684c1
CFLAGS ?=
Packit Service 4684c1
LDFLAGS ?=
Packit Service 4684c1
LCOV_INFO = coverage.info
Packit Service 4684c1
Packit Service 4684c1
coverage-prepare: clean
Packit Service 4684c1
	rm -rf $(LCOV_INFO) ../*/*.gc?? ../*/.libs/*.gc?? lcov/
Packit Service 4684c1
	lcov --zerocounters --directory ../lib/
Packit Service 4684c1
	$(MAKE) -C .. clean
Packit Service 4684c1
	$(MAKE) -C ../gl
Packit Service 4684c1
	$(MAKE) -C ../lib CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage"
Packit Service 4684c1
Packit Service 4684c1
coverage:
Packit Service 4684c1
	lcov --capture --initial --directory ../lib/ --output-file $(LCOV_INFO)
Packit Service 4684c1
	$(MAKE) check CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage"
Packit Service 4684c1
	lcov --capture --directory ../lib/ --output-file $(LCOV_INFO)
Packit Service 4684c1
	lcov --remove $(LCOV_INFO) '/usr/include/*' '*/gl/*' -o $(LCOV_INFO)
Packit Service 4684c1
	genhtml --prefix . --ignore-errors source $(LCOV_INFO) --legend --title "gnutls-fuzz" --output-directory=lcov
Packit Service 4684c1
	@echo
Packit Service 4684c1
	@echo "You can now view the coverage report with 'xdg-open lcov/index.html'"