3 # Future imports for Python 2.7, mandatory in 3.0
4 from __future__
import division
5 from __future__
import print_function
6 from __future__
import unicode_literals
30 $(src_test_AM_CPPFLAGS) $(TEST_CPPFLAGS)
32 $(AM_CFLAGS) $(TEST_CFLAGS)
34 @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) @TOR_LDFLAGS_libevent@
36 src/test/libtor-testing.a \
37 @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
38 @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
39 @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@ \
46 src/test/libtor-testing.a
49 src/test/fuzz/fuzzing.h
51 LIBFUZZER_CPPFLAGS = $(FUZZING_CPPFLAGS) -DLLVM_FUZZ
52 LIBFUZZER_CFLAGS = $(FUZZING_CFLAGS)
53 LIBFUZZER_LDFLAG = $(FUZZING_LDFLAG) -fsanitize=fuzzer
54 LIBFUZZER_LIBS = $(FUZZING_LIBS) -lstdc++
56 LIBOSS_FUZZ_CPPFLAGS = $(FUZZING_CPPFLAGS) -DLLVM_FUZZ
57 LIBOSS_FUZZ_CFLAGS = $(FUZZING_CFLAGS)
61 noinst_PROGRAMS += $(FUZZERS) $(LIBFUZZER_FUZZERS)
62 noinst_LIBRARIES += $(OSS_FUZZ_FUZZERS)
63 oss-fuzz-fuzzers: oss-fuzz-prereqs $(OSS_FUZZ_FUZZERS)
64 fuzzers: $(FUZZERS) $(LIBFUZZER_FUZZERS)
66 test-fuzz-corpora: $(FUZZERS)
67 $(top_srcdir)/src/test/fuzz_static_testcases.sh
70 ########### No user serviceable parts will follow.
72 PREAMBLE
= PREAMBLE
.strip()
73 POSTAMBLE
= POSTAMBLE
.strip() # If I use it, it's a word!
74 FUZZERS
= FUZZERS
.split()
78 # This file was generated by fuzzing_include_am.py; do not hand-edit unless
79 # you enjoy having your changes erased.
86 print("\n# ===== AFL fuzzers")
89 return s
.replace("-", "_")
91 for fuzzer
in FUZZERS
:
92 idname
= get_id_name(fuzzer
)
95 src_test_fuzz_fuzz_{name}_SOURCES = \\
96 src/test/fuzz/fuzzing_common.c \\
97 src/test/fuzz/fuzz_{name}.c
98 src_test_fuzz_fuzz_{name}_CPPFLAGS = $(FUZZING_CPPFLAGS)
99 src_test_fuzz_fuzz_{name}_CFLAGS = $(FUZZING_CFLAGS)
100 src_test_fuzz_fuzz_{name}_LDFLAGS = $(FUZZING_LDFLAG)
101 src_test_fuzz_fuzz_{name}_LDADD = $(FUZZING_LIBS)
103 """.format(name
=idname
))
105 print("if UNITTESTS_ENABLED")
106 print("FUZZERS = \\")
107 print(" \\\n".join("\tsrc/test/fuzz/fuzz-{name}".format(name
=fuzzer
)
108 for fuzzer
in FUZZERS
))
111 print("\n# ===== libfuzzer")
112 print("\nif LIBFUZZER_ENABLED")
114 for fuzzer
in FUZZERS
:
115 idname
= get_id_name(fuzzer
)
118 src_test_fuzz_lf_fuzz_{name}_SOURCES = \\
119 $(src_test_fuzz_fuzz_{name}_SOURCES)
120 src_test_fuzz_lf_fuzz_{name}_CPPFLAGS = $(LIBFUZZER_CPPFLAGS)
121 src_test_fuzz_lf_fuzz_{name}_CFLAGS = $(LIBFUZZER_CFLAGS)
122 src_test_fuzz_lf_fuzz_{name}_LDFLAGS = $(LIBFUZZER_LDFLAG)
123 src_test_fuzz_lf_fuzz_{name}_LDADD = $(LIBFUZZER_LIBS)
125 """.format(name
=idname
))
127 print("LIBFUZZER_FUZZERS = \\")
128 print(" \\\n".join("\tsrc/test/fuzz/lf-fuzz-{name}".format(name
=fuzzer
)
129 for fuzzer
in FUZZERS
))
136 print("\n# ===== oss-fuzz\n")
137 print("if OSS_FUZZ_ENABLED")
139 for fuzzer
in FUZZERS
:
140 idname
= get_id_name(fuzzer
)
143 src_test_fuzz_liboss_fuzz_{name}_a_SOURCES = \\
144 $(src_test_fuzz_fuzz_{name}_SOURCES)
145 src_test_fuzz_liboss_fuzz_{name}_a_CPPFLAGS = $(LIBOSS_FUZZ_CPPFLAGS)
146 src_test_fuzz_liboss_fuzz_{name}_a_CFLAGS = $(LIBOSS_FUZZ_CFLAGS)
148 """.format(name
=idname
))
150 print("OSS_FUZZ_FUZZERS = \\")
151 print(" \\\n".join("\tsrc/test/fuzz/liboss-fuzz-{name}.a".format(name
=fuzzer
)
152 for fuzzer
in FUZZERS
))