contrib/lz4/ossfuzz/Makefile in extlz4-0.3.1 vs contrib/lz4/ossfuzz/Makefile in extlz4-0.3.2
- old
+ new
@@ -24,11 +24,11 @@
# compress_fuzzer : OSS Fuzz test tool
# decompress_fuzzer : OSS Fuzz test tool
# ##########################################################################
LZ4DIR := ../lib
-LIB_FUZZING_ENGINE ?= standaloneengine.o
+LIB_FUZZING_ENGINE ?=
DEBUGLEVEL?= 1
DEBUGFLAGS = -g -DLZ4_DEBUG=$(DEBUGLEVEL)
LZ4_CFLAGS = $(CFLAGS) $(DEBUGFLAGS) $(MOREFLAGS)
@@ -45,10 +45,11 @@
round_trip_hc_fuzzer \
compress_frame_fuzzer \
round_trip_frame_fuzzer \
decompress_frame_fuzzer
+.PHONY: all
all: $(FUZZERS)
# Include a rule to build the static library if calling this target
# directly.
$(LZ4DIR)/liblz4.a:
@@ -56,19 +57,22 @@
%.o: %.c
$(CC) -c $(LZ4_CFLAGS) $(LZ4_CPPFLAGS) $< -o $@
# Generic rule for generating fuzzers
-%_fuzzer: %_fuzzer.o lz4_helpers.o $(LZ4DIR)/liblz4.a
- # Compile the standalone code just in case. The OSS-Fuzz code might
- # override the LIB_FUZZING_ENGINE value to "-fsanitize=fuzzer"
- $(CC) -c $(LZ4_CFLAGS) $(LZ4_CPPFLAGS) standaloneengine.c -o standaloneengine.o
-
- # Now compile the actual fuzzer.
+ifeq ($(LIB_FUZZING_ENGINE),)
+ LIB_FUZZING_DEPS := standaloneengine.o
+else
+ LIB_FUZZING_DEPS :=
+endif
+%_fuzzer: %_fuzzer.o lz4_helpers.o fuzz_data_producer.o $(LZ4DIR)/liblz4.a $(LIB_FUZZING_DEPS)
$(CXX) $(LZ4_CXXFLAGS) $(LZ4_CPPFLAGS) $(LDFLAGS) $(LIB_FUZZING_ENGINE) $^ -o $@$(EXT)
%_fuzzer_clean:
$(RM) $*_fuzzer $*_fuzzer.o standaloneengine.o
.PHONY: clean
-clean: compress_fuzzer_clean decompress_fuzzer_clean
+clean: compress_fuzzer_clean decompress_fuzzer_clean \
+ compress_frame_fuzzer_clean compress_hc_fuzzer_clean \
+ decompress_frame_fuzzer_clean round_trip_frame_fuzzer_clean \
+ round_trip_fuzzer_clean round_trip_hc_fuzzer_clean round_trip_stream_fuzzer_clean
$(MAKE) -C $(LZ4DIR) clean