CC = ./clang CFLAGS = -g -fsanitize=address,array-bounds,null,return,shift -fsanitize-coverage=trace-pc-guard -I. CXX = ./clang++ CXXFLAGS = $(CFLAGS) -std=c++11 LDFLAGS = -L. LDLIBS = -lwolfssl -lFuzzer PYTHON = python2 prefix = ./out libFuzzer = libFuzzer.a fuzzer_dir = Fuzzer fuzzer_src = https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer new_clang = new_clang clang_tool_src = https://chromium.googlesource.com/chromium/src/tools/clang clang_dir = $(new_clang)/clang/clang clang_tool = $(clang_dir)/scripts/update.py clang_bin = $(new_clang)/third_party/llvm-build/Release+Asserts/bin/ src = $(wildcard ./*/target.c) opt = $(wildcard ./*/target.options) trg = $(notdir $(src:/target.c=)) trg_opt = $(notdir $(opt:/target.options=)) obj = $(src:.c=.o) out = $(src:.c=) targets = $(patsubst %,$(prefix)/%, $(trg)) corpora = $(patsubst %,$(prefix)/%_seed_corpus.zip,$(trg)) optionses = $(patsubst %,$(prefix)/%.options, $(trg_opt)) found_dictionaries = $(wildcard ./*.dict) dictionaries = $(addprefix $(prefix)/,$(notdir $(found_dictionaries))) exports = $(targets) $(corpora) $(optionses) $(dictionaries) all: $(out) # make all export: $(prefix) $(exports) # not quite install, but close deps: $(CC) $(CXX) $(libFuzzer) # dependencies dependencies: deps # deps alias %: %.c # cancel the implicit rule %: %.cc # cancel the implicit rule .PHONY: clean spotless export unexport .INTERMEDIATE: $(obj) # libFuzzer $(fuzzer_dir): @echo -e "\nRetrieving libFuzzer...\n" @git clone $(fuzzer_src) $@ --depth 1 $(libFuzzer): $(fuzzer_dir) @bash $