John Andersen | 443455b | 2019-01-16 12:58:36 -0800 | [diff] [blame] | 1 | # SPDX-License-Identifier: BSD-2 |
| 2 | # Copyright (c) 2019 Intel Corporation |
| 3 | # All rights reserved. |
| 4 | |
John Andersen | 4eab6da | 2019-01-16 13:59:16 -0800 | [diff] [blame] | 5 | TEST_EXTENSIONS += .fuzz |
| 6 | FUZZ_LOG_COMPILER = $(srcdir)/script/fuzz-log-compiler.sh |
John Andersen | 443455b | 2019-01-16 12:58:36 -0800 | [diff] [blame] | 7 | INCLUDE_DIRS += -I$(srcdir)/test/fuzz/tcti |
Tadeusz Struk | 39d1aed | 2019-03-01 08:47:56 -0800 | [diff] [blame] | 8 | TESTS_LIBADD = $(lib_LTLIBRARIES) $(libtss2_mu) $(libtss2_sys) $(libutil) |
John Andersen | 443455b | 2019-01-16 12:58:36 -0800 | [diff] [blame] | 9 | |
| 10 | # tcti library used for fuzzing |
| 11 | if ENABLE_TCTI_FUZZING |
| 12 | libtss2_tcti_fuzzing = test/fuzz/tcti/libtss2-tcti-fuzzing.la |
| 13 | noinst_LTLIBRARIES += $(libtss2_tcti_fuzzing) |
| 14 | |
| 15 | test_fuzz_tcti_libtss2_tcti_fuzzing_la_CFLAGS = $(AM_CFLAGS) |
Tadeusz Struk | 39d1aed | 2019-03-01 08:47:56 -0800 | [diff] [blame] | 16 | test_fuzz_tcti_libtss2_tcti_fuzzing_la_LIBADD = $(TESTS_LIBADD) |
John Andersen | 443455b | 2019-01-16 12:58:36 -0800 | [diff] [blame] | 17 | test_fuzz_tcti_libtss2_tcti_fuzzing_la_SOURCES = \ |
| 18 | src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \ |
| 19 | test/fuzz/tcti/tcti-fuzzing.c test/fuzz/tcti/tcti-fuzzing.h |
| 20 | endif # ENABLE_TCTI_FUZZING |
John Andersen | 4eab6da | 2019-01-16 13:59:16 -0800 | [diff] [blame] | 21 | |
| 22 | if ENABLE_FUZZING |
| 23 | FUZZ_CFLAGS = $(TESTS_CFLAGS) -I$(srcdir)/test/integration |
Tadeusz Struk | 39d1aed | 2019-03-01 08:47:56 -0800 | [diff] [blame] | 24 | FUZZ_CPPFLAGS = $(INCLUDE_DIRS) -I$(srcdir)/test/integration $(LIB_FUZZING_ENGINE) |
John Andersen | 4eab6da | 2019-01-16 13:59:16 -0800 | [diff] [blame] | 25 | |
Tadeusz Struk | 39d1aed | 2019-03-01 08:47:56 -0800 | [diff] [blame] | 26 | libtss2_utils_fuzzing = test/fuzz/libfuzz_utils.la |
| 27 | noinst_LTLIBRARIES += $(libtss2_utils_fuzzing) |
| 28 | test_fuzz_libfuzz_utils_la_LDFLAGS = $(TESTS_LDFLAGS) |
| 29 | test_fuzz_libfuzz_utils_la_LIBADD = $(TESTS_LIBADD) |
John Andersen | 4eab6da | 2019-01-16 13:59:16 -0800 | [diff] [blame] | 30 | test_fuzz_libfuzz_utils_la_CFLAGS = $(AM_CFLAGS) $(FUZZ_CFLAGS) |
| 31 | test_fuzz_libfuzz_utils_la_SOURCES = \ |
| 32 | test/integration/sapi-context-util.c test/integration/context-util.h \ |
| 33 | test/integration/sapi-test-options.c test/integration/test-options.h |
| 34 | |
Tadeusz Struk | 39d1aed | 2019-03-01 08:47:56 -0800 | [diff] [blame] | 35 | TESTS_LDADD += $(libtss2_utils_fuzzing) |
| 36 | FUZZ_LDADD = $(TESTS_LDADD) $(TESTS_LDFLAGS) $(FUZZ_LDFLAGS) |
| 37 | |
John Andersen | 4eab6da | 2019-01-16 13:59:16 -0800 | [diff] [blame] | 38 | fuzzdir = $(srcdir) |
| 39 | fuzz-targets: $(fuzz_PROGRAMS) |
| 40 | |
| 41 | check_PROGRAMS += $(TESTS_FUZZ) |
| 42 | fuzz_PROGRAMS = $(TESTS_FUZZ) |
| 43 | FUZZ = $(check_PROGRAMS) |
| 44 | |
Tadeusz Struk | 39d1aed | 2019-03-01 08:47:56 -0800 | [diff] [blame] | 45 | DISTCLEANFILES = Makefile-fuzz-generated.am |
| 46 | |
John Andersen | 4eab6da | 2019-01-16 13:59:16 -0800 | [diff] [blame] | 47 | include Makefile-fuzz-generated.am |
| 48 | endif # ENABLE_FUZZING |