~mmach/netext73/lz4

« back to all changes in this revision

Viewing changes to ossfuzz/Makefile

  • Committer: mmach
  • Date: 2020-11-29 19:46:48 UTC
  • Revision ID: netbit73@gmail.com-20201129194648-8g87ivgzol71gnma
1.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
# ##########################################################################
27
27
 
28
28
LZ4DIR  := ../lib
29
 
LIB_FUZZING_ENGINE ?= standaloneengine.o
 
29
LIB_FUZZING_ENGINE ?=
30
30
 
31
31
DEBUGLEVEL?= 1
32
 
DEBUGFLAGS =
 
32
DEBUGFLAGS = -g -DLZ4_DEBUG=$(DEBUGLEVEL)
33
33
 
34
34
LZ4_CFLAGS  = $(CFLAGS) $(DEBUGFLAGS) $(MOREFLAGS)
35
35
LZ4_CXXFLAGS = $(CXXFLAGS) $(DEBUGFLAGS) $(MOREFLAGS)
47
47
        round_trip_frame_fuzzer \
48
48
        decompress_frame_fuzzer
49
49
 
 
50
.PHONY: all
50
51
all: $(FUZZERS)
51
52
 
52
53
# Include a rule to build the static library if calling this target
58
59
        $(CC) -c $(LZ4_CFLAGS) $(LZ4_CPPFLAGS) $< -o $@
59
60
 
60
61
# Generic rule for generating fuzzers
61
 
%_fuzzer: %_fuzzer.o lz4_helpers.o fuzz_data_producer.o $(LZ4DIR)/liblz4.a
62
 
        # Compile the standalone code just in case. The OSS-Fuzz code might
63
 
        # override the LIB_FUZZING_ENGINE value to "-fsanitize=fuzzer"
64
 
        $(CC) -c $(LZ4_CFLAGS) $(LZ4_CPPFLAGS) standaloneengine.c -o standaloneengine.o
65
 
 
66
 
        # Now compile the actual fuzzer.
 
62
ifeq ($(LIB_FUZZING_ENGINE),)
 
63
  LIB_FUZZING_DEPS := standaloneengine.o
 
64
else
 
65
  LIB_FUZZING_DEPS :=
 
66
endif
 
67
%_fuzzer: %_fuzzer.o lz4_helpers.o fuzz_data_producer.o $(LZ4DIR)/liblz4.a $(LIB_FUZZING_DEPS)
67
68
        $(CXX) $(LZ4_CXXFLAGS) $(LZ4_CPPFLAGS) $(LDFLAGS) $(LIB_FUZZING_ENGINE) $^ -o $@$(EXT)
68
69
 
69
70
%_fuzzer_clean:
70
71
        $(RM) $*_fuzzer $*_fuzzer.o standaloneengine.o
71
72
 
72
73
.PHONY: clean
73
 
clean: compress_fuzzer_clean decompress_fuzzer_clean
 
74
clean: compress_fuzzer_clean decompress_fuzzer_clean \
 
75
        compress_frame_fuzzer_clean compress_hc_fuzzer_clean \
 
76
        decompress_frame_fuzzer_clean round_trip_frame_fuzzer_clean \
 
77
        round_trip_fuzzer_clean round_trip_hc_fuzzer_clean round_trip_stream_fuzzer_clean
74
78
        $(MAKE) -C $(LZ4DIR) clean