1# This Makefile will compile all fuzzing targets. It doesn't check tool
2# requirements and paths may need to be updated depending on your environment.
3# Note a clang 6+ toolchain is assumed for use of -fsanitize=fuzzer.
4
5CC = clang
6CXX = clang++
7CFLAGS = -fsanitize=fuzzer -I../../src -I../.. -Wall -Wextra
8CXXFLAGS = $(CFLAGS)
9LDFLAGS = -fsanitize=fuzzer
10LDLIBS = ../../src/mux/libwebpmux.a ../../src/demux/libwebpdemux.a
11LDLIBS += ../../src/libwebp.a ../../imageio/libimageio_util.a
12
13FUZZERS = advanced_api_fuzzer animation_api_fuzzer animencoder_fuzzer
14FUZZERS += animdecoder_fuzzer mux_demux_api_fuzzer enc_dec_fuzzer
15FUZZERS += simple_api_fuzzer
16
17%.o: fuzz_utils.h img_alpha.h img_grid.h img_peak.h
18all: $(FUZZERS)
19
20define FUZZER_template
21$(1): $$(addsuffix .o, $(1)) $(LDLIBS)
22OBJS += $$(addsuffix .o, $(1))
23endef
24
25$(foreach fuzzer, $(FUZZERS), $(eval $(call FUZZER_template, $(fuzzer))))
26
27clean:
28	$(RM) $(FUZZERS) $(OBJS)
29
30.PHONY: all clean
31