Makefile.fuzz_test 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #CXX = clang++
  2. CXXFLAGS += -ggdb -O0 -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra -Wtype-limits -Wconversion
  3. OPENSSL_DIR = /usr/local/opt/[email protected]
  4. OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto
  5. ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz
  6. BROTLI_DIR = /usr/local/opt/brotli
  7. BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon -lbrotlienc -lbrotlidec
  8. # By default, use standalone_fuzz_target_runner.
  9. # This runner does no fuzzing, but simply executes the inputs
  10. # provided via parameters.
  11. # Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
  12. # to link the fuzzer(s) against a real fuzzing engine.
  13. # OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
  14. LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
  15. # Runs server_fuzzer.cc based on value of $(LIB_FUZZING_ENGINE).
  16. # Usage: make fuzz_test LIB_FUZZING_ENGINE=/path/to/libFuzzer
  17. all fuzz_test: server_fuzzer
  18. ./server_fuzzer fuzzing/corpus/*
  19. # Fuzz target, so that you can choose which $(LIB_FUZZING_ENGINE) to use.
  20. server_fuzzer : fuzzing/server_fuzzer.cc ../httplib.h standalone_fuzz_target_runner.o
  21. $(CXX) $(CXXFLAGS) -o $@ $< $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) $(LIB_FUZZING_ENGINE) -pthread
  22. # Standalone fuzz runner, which just reads inputs from fuzzing/corpus/ dir and
  23. # feeds it to server_fuzzer.
  24. standalone_fuzz_target_runner.o : fuzzing/standalone_fuzz_target_runner.cpp
  25. $(CXX) $(CXXFLAGS) -c -o $@ $<
  26. clean:
  27. rm -f server_fuzzer pem *.0 *.o *.1 *.srl *.zip