blob: 940484db926739a59eae0ed8a162b6d42b12167a [file] [log] [blame]
Jens Geyer72a714e2025-08-26 22:12:07 +02001#
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 Lakhani37f4e0d2025-08-25 11:21:33 -07009#
10# http://www.apache.org/licenses/LICENSE-2.0
Jens Geyer72a714e2025-08-26 22:12:07 +020011#
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 Lakhani37f4e0d2025-08-25 11:21:33 -070019
20AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
21
22# Generate FuzzTest code
23BUILT_SOURCES = gen-cpp/FuzzTest_types.h
24
25noinst_LTLIBRARIES = libfuzztest_gen.la
26
27nodist_libfuzztest_gen_la_SOURCES = \
28 gen-cpp/FuzzTest_types.cpp \
29 gen-cpp/FuzzTest_types.h
30
31libfuzztest_gen_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la
32
33# Common fuzzing headers
34noinst_HEADERS = FuzzCommon.tcc
35
36# Fuzzing executables
37AM_CPPFLAGS = -I$(top_srcdir)/lib/cpp/src -I$(top_srcdir)/lib/cpp/src/thrift -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I.
38
39check_PROGRAMS = FuzzParseCompact FuzzParseBinary FuzzRoundtripCompact FuzzRoundtripBinary FuzzParseJson FuzzRoundtripJson
40
41FuzzParseCompact_SOURCES = FuzzParseCompact.cpp FuzzCommon.tcc
42FuzzParseCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
43FuzzParseCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
44if USING_CLANG
45FuzzParseCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
46endif
47
48FuzzRoundtripCompact_SOURCES = FuzzRoundtripCompact.cpp FuzzCommon.tcc
49FuzzRoundtripCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
50FuzzRoundtripCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
51if USING_CLANG
52FuzzRoundtripCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
53endif
54
55FuzzParseBinary_SOURCES = FuzzParseBinary.cpp FuzzCommon.tcc
56FuzzParseBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
57FuzzParseBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
58if USING_CLANG
59FuzzParseBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
60endif
61
62FuzzRoundtripBinary_SOURCES = FuzzRoundtripBinary.cpp FuzzCommon.tcc
63FuzzRoundtripBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
64FuzzRoundtripBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
65if USING_CLANG
66FuzzRoundtripBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
67endif
68
69FuzzParseJson_SOURCES = FuzzParseJson.cpp FuzzCommon.tcc
70FuzzParseJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
71FuzzParseJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
72if USING_CLANG
73FuzzParseJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
74endif
75
76FuzzRoundtripJson_SOURCES = FuzzRoundtripJson.cpp FuzzCommon.tcc
77FuzzRoundtripJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
78FuzzRoundtripJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
79if USING_CLANG
80FuzzRoundtripJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
81endif
82
83# Generate thrift files
84gen-cpp/FuzzTest_types.cpp gen-cpp/FuzzTest_types.h: $(top_srcdir)/test/FuzzTest.thrift
85 $(THRIFT) --gen cpp $<
86
87# Clean target
88clean-local:
89 $(RM) -rf gen-cpp
90 $(RM) -f $(check_PROGRAMS)
91 $(RM) -f *.o *.lo *.la
92 $(RM) -rf .libs
93
94CLEANFILES = gen-cpp/*
95
96EXTRA_DIST = CMakeLists.txt FuzzParseCompact.cpp FuzzParseBinary.cpp FuzzRoundtripCompact.cpp FuzzRoundtripBinary.cpp FuzzParseJson.cpp FuzzRoundtripJson.cpp