blob: a4fc1b9f531f542c7e073651078ea8132981df2e [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
Hasnain Lakhani37f4e0d2025-08-25 11:21:33 -070022noinst_LTLIBRARIES = libfuzztest_gen.la
23
24nodist_libfuzztest_gen_la_SOURCES = \
25 gen-cpp/FuzzTest_types.cpp \
26 gen-cpp/FuzzTest_types.h
27
28libfuzztest_gen_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la
29
30# Common fuzzing headers
31noinst_HEADERS = FuzzCommon.tcc
32
33# Fuzzing executables
34AM_CPPFLAGS = -I$(top_srcdir)/lib/cpp/src -I$(top_srcdir)/lib/cpp/src/thrift -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I.
35
36check_PROGRAMS = FuzzParseCompact FuzzParseBinary FuzzRoundtripCompact FuzzRoundtripBinary FuzzParseJson FuzzRoundtripJson
37
38FuzzParseCompact_SOURCES = FuzzParseCompact.cpp FuzzCommon.tcc
39FuzzParseCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
40FuzzParseCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
41if USING_CLANG
42FuzzParseCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
43endif
44
45FuzzRoundtripCompact_SOURCES = FuzzRoundtripCompact.cpp FuzzCommon.tcc
46FuzzRoundtripCompact_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
47FuzzRoundtripCompact_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
48if USING_CLANG
49FuzzRoundtripCompact_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
50endif
51
52FuzzParseBinary_SOURCES = FuzzParseBinary.cpp FuzzCommon.tcc
53FuzzParseBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
54FuzzParseBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
55if USING_CLANG
56FuzzParseBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
57endif
58
59FuzzRoundtripBinary_SOURCES = FuzzRoundtripBinary.cpp FuzzCommon.tcc
60FuzzRoundtripBinary_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
61FuzzRoundtripBinary_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
62if USING_CLANG
63FuzzRoundtripBinary_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
64endif
65
66FuzzParseJson_SOURCES = FuzzParseJson.cpp FuzzCommon.tcc
67FuzzParseJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
68FuzzParseJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
69if USING_CLANG
70FuzzParseJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
71endif
72
73FuzzRoundtripJson_SOURCES = FuzzRoundtripJson.cpp FuzzCommon.tcc
74FuzzRoundtripJson_LDADD = libfuzztest_gen.la $(top_builddir)/lib/cpp/libthrift.la
75FuzzRoundtripJson_CXXFLAGS = $(AM_CXXFLAGS) $(AM_CPPFLAGS) -g
76if USING_CLANG
77FuzzRoundtripJson_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
78endif
79
80# Generate thrift files
81gen-cpp/FuzzTest_types.cpp gen-cpp/FuzzTest_types.h: $(top_srcdir)/test/FuzzTest.thrift
82 $(THRIFT) --gen cpp $<
83
Jens Geyer21a89c62026-04-09 22:48:02 +000084# Ensure generated headers exist before compiling sources that include them
85FuzzParseCompact.$(OBJEXT): gen-cpp/FuzzTest_types.h
86FuzzParseBinary.$(OBJEXT): gen-cpp/FuzzTest_types.h
87FuzzRoundtripCompact.$(OBJEXT): gen-cpp/FuzzTest_types.h
88FuzzRoundtripBinary.$(OBJEXT): gen-cpp/FuzzTest_types.h
89FuzzParseJson.$(OBJEXT): gen-cpp/FuzzTest_types.h
90FuzzRoundtripJson.$(OBJEXT): gen-cpp/FuzzTest_types.h
91
Hasnain Lakhani37f4e0d2025-08-25 11:21:33 -070092# Clean target
93clean-local:
94 $(RM) -rf gen-cpp
95 $(RM) -f $(check_PROGRAMS)
96 $(RM) -f *.o *.lo *.la
97 $(RM) -rf .libs
98
99CLEANFILES = gen-cpp/*
100
101EXTRA_DIST = CMakeLists.txt FuzzParseCompact.cpp FuzzParseBinary.cpp FuzzRoundtripCompact.cpp FuzzRoundtripBinary.cpp FuzzParseJson.cpp FuzzRoundtripJson.cpp