1sed -i 's/main(/fuzz_without_main(/g' src/core/nginx.c
2
3mkdir -p $NGX_OBJS/src/fuzz
4
5ngx_all_objs_fuzz=`echo src/fuzz/wrappers.c $ngx_all_srcs \
6    | sed -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
7          -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g"`
8
9ngx_deps_fuzz=`echo $ngx_all_objs_fuzz $ngx_modules_obj $ngx_res $LINK_DEPS \
10    | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
11          -e "s/\//$ngx_regex_dirsep/g"`
12
13ngx_objs=`echo objs/src/fuzz/wrappers.o $ngx_all_objs $ngx_modules_obj \
14    | sed -e "s/  *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
15          -e "s/\//$ngx_regex_dirsep/g"`
16
17cat << END                                                    >> $NGX_MAKEFILE
18
19fuzzers: objs/http_request_fuzzer
20
21objs/src/fuzz/wrappers.o:
22	\$(CC) $ngx_compile_opt \$(CFLAGS) -o objs/src/fuzz/wrappers.o src/fuzz/wrappers.c
23
24objs/http_request_fuzzer: $ngx_deps_fuzz
25	 \$(CXX) \$(CXXFLAGS) src/fuzz/http_request_fuzzer.cc \
26	 src/fuzz/genfiles/http_request_proto.pb.cc \
27	 -o objs/http_request_fuzzer \
28	 \$(CORE_INCS) \$(HTTP_INCS) \
29	 -I src/fuzz/genfiles/ -I \$(SRC)/ \
30	 -I \$(SRC)/libprotobuf-mutator/ \
31	 -I \$(SRC)/LPM/external.protobuf/include \
32	 \$(SRC)/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
33  	 \$(SRC)/LPM/src/libprotobuf-mutator.a \
34  	 \$(SRC)/LPM/external.protobuf/lib/libprotobuf.a \
35	 $ngx_binexit$ngx_long_cont$ngx_objs \
36   	 \$(LIB_FUZZING_ENGINE) $ngx_libs$ngx_link$ngx_main_link -lcrypt
37$ngx_long_end
38
39END
40