Jens Geyer | 72a714e | 2025-08-26 22:12:07 +0200 | [diff] [blame^] | 1 | # |
| 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
Hasnain Lakhani | 37f4e0d | 2025-08-25 11:21:33 -0700 | [diff] [blame] | 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
Jens Geyer | 72a714e | 2025-08-26 22:12:07 +0200 | [diff] [blame^] | 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
Hasnain Lakhani | 37f4e0d | 2025-08-25 11:21:33 -0700 | [diff] [blame] | 19 | |
| 20 | AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc |
| 21 | |
| 22 | # Generate FuzzTest code |
| 23 | BUILT_SOURCES = gen-cpp/FuzzTest_types.h |
| 24 | |
| 25 | noinst_LTLIBRARIES = libfuzztest_gen.la |
| 26 | |
| 27 | nodist_libfuzztest_gen_la_SOURCES = \ |
| 28 | gen-cpp/FuzzTest_types.cpp \ |
| 29 | gen-cpp/FuzzTest_types.h |
| 30 | |
| 31 | libfuzztest_gen_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la |
| 32 | |
| 33 | # Common fuzzing headers |
| 34 | noinst_HEADERS = FuzzCommon.tcc |
| 35 | |
| 36 | # Fuzzing executables |
| 37 | AM_CPPFLAGS = -I$(top_srcdir)/lib/cpp/src -I$(top_srcdir)/lib/cpp/src/thrift -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. |
| 38 | |
| 39 | check_PROGRAMS = FuzzParseCompact FuzzParseBinary FuzzRoundtripCompact FuzzRoundtripBinary FuzzParseJson FuzzRoundtripJson |
| 40 | |
| 41 | FuzzParseCompact_SOURCES = FuzzParseCompact.cpp FuzzCommon.tcc |
| 42 | FuzzParseCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 43 | FuzzParseCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 44 | if USING_CLANG |
| 45 | FuzzParseCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 46 | endif |
| 47 | |
| 48 | FuzzRoundtripCompact_SOURCES = FuzzRoundtripCompact.cpp FuzzCommon.tcc |
| 49 | FuzzRoundtripCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 50 | FuzzRoundtripCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 51 | if USING_CLANG |
| 52 | FuzzRoundtripCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 53 | endif |
| 54 | |
| 55 | FuzzParseBinary_SOURCES = FuzzParseBinary.cpp FuzzCommon.tcc |
| 56 | FuzzParseBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 57 | FuzzParseBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 58 | if USING_CLANG |
| 59 | FuzzParseBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 60 | endif |
| 61 | |
| 62 | FuzzRoundtripBinary_SOURCES = FuzzRoundtripBinary.cpp FuzzCommon.tcc |
| 63 | FuzzRoundtripBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 64 | FuzzRoundtripBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 65 | if USING_CLANG |
| 66 | FuzzRoundtripBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 67 | endif |
| 68 | |
| 69 | FuzzParseJson_SOURCES = FuzzParseJson.cpp FuzzCommon.tcc |
| 70 | FuzzParseJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 71 | FuzzParseJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 72 | if USING_CLANG |
| 73 | FuzzParseJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 74 | endif |
| 75 | |
| 76 | FuzzRoundtripJson_SOURCES = FuzzRoundtripJson.cpp FuzzCommon.tcc |
| 77 | FuzzRoundtripJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la |
| 78 | FuzzRoundtripJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g |
| 79 | if USING_CLANG |
| 80 | FuzzRoundtripJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer |
| 81 | endif |
| 82 | |
| 83 | # Generate thrift files |
| 84 | gen-cpp/FuzzTest_types.cpp gen-cpp/FuzzTest_types.h: $(top_srcdir)/test/FuzzTest.thrift |
| 85 | $(THRIFT) --gen cpp $< |
| 86 | |
| 87 | # Clean target |
| 88 | clean-local: |
| 89 | $(RM) -rf gen-cpp |
| 90 | $(RM) -f $(check_PROGRAMS) |
| 91 | $(RM) -f *.o *.lo *.la |
| 92 | $(RM) -rf .libs |
| 93 | |
| 94 | CLEANFILES = gen-cpp/* |
| 95 | |
| 96 | EXTRA_DIST = CMakeLists.txt FuzzParseCompact.cpp FuzzParseBinary.cpp FuzzRoundtripCompact.cpp FuzzRoundtripBinary.cpp FuzzParseJson.cpp FuzzRoundtripJson.cpp |