Hasnain Lakhani | 37f4e0d | 2025-08-25 11:21:33 -0700 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | # you may not use this file except in compliance with the License. |
| 3 | # You may obtain a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | |
| 7 | AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc |
| 8 | |
| 9 | # Generate FuzzTest code |
| 10 | BUILT_SOURCES = gen-cpp/FuzzTest_types.h |
| 11 | |
| 12 | noinst_LTLIBRARIES = libfuzztest_gen.la |
| 13 | |
| 14 | nodist_libfuzztest_gen_la_SOURCES = \ |
| 15 | gen-cpp/FuzzTest_types.cpp \ |
| 16 | gen-cpp/FuzzTest_types.h |
| 17 | |
| 18 | libfuzztest_gen_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la |
| 19 | |
| 20 | # Common fuzzing headers |
| 21 | noinst_HEADERS = FuzzCommon.tcc |
| 22 | |
| 23 | # Fuzzing executables |
| 24 | AM_CPPFLAGS = -I$(top_srcdir)/lib/cpp/src -I$(top_srcdir)/lib/cpp/src/thrift -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. |
| 25 | |
| 26 | check_PROGRAMS = FuzzParseCompact FuzzParseBinary FuzzRoundtripCompact FuzzRoundtripBinary FuzzParseJson FuzzRoundtripJson |
| 27 | |
| 28 | FuzzParseCompact_SOURCES = FuzzParseCompact.cpp FuzzCommon.tcc |
| 29 | FuzzParseCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 30 | FuzzParseCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 31 | if USING_CLANG |
| 32 | FuzzParseCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 33 | endif |
| 34 | |
| 35 | FuzzRoundtripCompact_SOURCES = FuzzRoundtripCompact.cpp FuzzCommon.tcc |
| 36 | FuzzRoundtripCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 37 | FuzzRoundtripCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 38 | if USING_CLANG |
| 39 | FuzzRoundtripCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 40 | endif |
| 41 | |
| 42 | FuzzParseBinary_SOURCES = FuzzParseBinary.cpp FuzzCommon.tcc |
| 43 | FuzzParseBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 44 | FuzzParseBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 45 | if USING_CLANG |
| 46 | FuzzParseBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 47 | endif |
| 48 | |
| 49 | FuzzRoundtripBinary_SOURCES = FuzzRoundtripBinary.cpp FuzzCommon.tcc |
| 50 | FuzzRoundtripBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 51 | FuzzRoundtripBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 52 | if USING_CLANG |
| 53 | FuzzRoundtripBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 54 | endif |
| 55 | |
| 56 | FuzzParseJson_SOURCES = FuzzParseJson.cpp FuzzCommon.tcc |
| 57 | FuzzParseJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 58 | FuzzParseJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 59 | if USING_CLANG |
| 60 | FuzzParseJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 61 | endif |
| 62 | |
| 63 | FuzzRoundtripJson_SOURCES = FuzzRoundtripJson.cpp FuzzCommon.tcc |
| 64 | FuzzRoundtripJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 65 | FuzzRoundtripJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 66 | if USING_CLANG |
| 67 | FuzzRoundtripJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 68 | endif |
| 69 | |
| 70 | # Generate thrift files |
| 71 | gen-cpp/FuzzTest_types.cpp gen-cpp/FuzzTest_types.h: $(top_srcdir)/test/FuzzTest.thrift |
| 72 | $(THRIFT) --gen cpp $< |
| 73 | |
| 74 | # Clean target |
| 75 | clean-local: |
| 76 | $(RM) -rf gen-cpp |
| 77 | $(RM) -f $(check_PROGRAMS) |
| 78 | $(RM) -f *.o *.lo *.la |
| 79 | $(RM) -rf .libs |
| 80 | |
| 81 | CLEANFILES = gen-cpp/* |
| 82 | |
| 83 | EXTRA_DIST = CMakeLists.txt FuzzParseCompact.cpp FuzzParseBinary.cpp FuzzRoundtripCompact.cpp FuzzRoundtripBinary.cpp FuzzParseJson.cpp FuzzRoundtripJson.cpp |