1
# ##########################################################################
2
# LZ4 oss fuzzer - Makefile
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License along
17
# with this program; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
# You can contact the author at :
21
# - LZ4 homepage : http://www.lz4.org
22
# - LZ4 source repository : https://github.com/lz4/lz4
23
# ##########################################################################
24
# compress_fuzzer : OSS Fuzz test tool
25
# decompress_fuzzer : OSS Fuzz test tool
26
# ##########################################################################
32
DEBUGFLAGS = -g -DLZ4_DEBUG=$(DEBUGLEVEL)
34
LZ4_CFLAGS = $(CFLAGS) $(DEBUGFLAGS) $(MOREFLAGS)
35
LZ4_CXXFLAGS = $(CXXFLAGS) $(DEBUGFLAGS) $(MOREFLAGS)
36
LZ4_CPPFLAGS = $(CPPFLAGS) -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_ \
37
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
43
round_trip_stream_fuzzer \
45
round_trip_hc_fuzzer \
46
compress_frame_fuzzer \
47
round_trip_frame_fuzzer \
48
round_trip_frame_uncompressed_fuzzer \
49
decompress_frame_fuzzer
54
# Include a rule to build the static library if calling this target
57
$(MAKE) -C $(LZ4DIR) CFLAGS="$(LZ4_CFLAGS)" liblz4.a
60
$(CC) -c $(LZ4_CFLAGS) $(LZ4_CPPFLAGS) $< -o $@
62
# Generic rule for generating fuzzers
63
ifeq ($(LIB_FUZZING_ENGINE),)
64
LIB_FUZZING_DEPS := standaloneengine.o
68
%_fuzzer: %_fuzzer.o lz4_helpers.o fuzz_data_producer.o $(LZ4DIR)/liblz4.a $(LIB_FUZZING_DEPS)
69
$(CXX) $(LZ4_CXXFLAGS) $(LZ4_CPPFLAGS) $(LDFLAGS) $(LIB_FUZZING_ENGINE) $^ -o $@$(EXT)
72
$(RM) $*_fuzzer $*_fuzzer.o standaloneengine.o
75
clean: compress_fuzzer_clean decompress_fuzzer_clean \
76
compress_frame_fuzzer_clean compress_hc_fuzzer_clean \
77
decompress_frame_fuzzer_clean round_trip_frame_fuzzer_clean \
78
round_trip_fuzzer_clean round_trip_hc_fuzzer_clean round_trip_stream_fuzzer_clean
79
$(MAKE) -C $(LZ4DIR) clean