contrib/fuzz/Makefile
author Augie Fackler <augie@google.com>
Sun, 29 Apr 2018 19:48:16 -0400
changeset 38175 fbe239064064
parent 38174 36d55f90e2a3
child 38230 bf901559e647
permissions -rw-r--r--
fuzz: add clean target Differential Revision: https://phab.mercurial-scm.org/D3677
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
     1
fuzzutil.o: fuzzutil.cc fuzzutil.h
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
     2
	$$CXX $$CXXFLAGS -g -O1 -fsanitize=fuzzer-no-link,address \
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
     3
	  -std=c++17 \
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
     4
	  -I../../mercurial -c -o fuzzutil.o fuzzutil.cc
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
     5
38174
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
     6
fuzzutil-oss-fuzz.o: fuzzutil.cc fuzzutil.h
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
     7
	$$CXX $$CXXFLAGS -std=c++17 \
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
     8
	  -I../../mercurial -c -o fuzzutil-oss-fuzz.o fuzzutil.cc
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
     9
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
bdiff.o: ../../mercurial/bdiff.c
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    11
	$$CC $$CFLAGS -fsanitize=fuzzer-no-link,address -c -o bdiff.o \
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
	  ../../mercurial/bdiff.c
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    13
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    14
bdiff: bdiff.cc bdiff.o fuzzutil.o
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    15
	$$CXX $$CXXFLAGS -DHG_FUZZER_INCLUDE_MAIN=1 -g -O1 -fsanitize=fuzzer-no-link,address \
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    16
	  -std=c++17 \
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    17
	  -I../../mercurial bdiff.cc bdiff.o fuzzutil.o -o bdiff
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    18
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    19
bdiff-oss-fuzz.o: ../../mercurial/bdiff.c
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    20
	$$CC $$CFLAGS -c -o bdiff-oss-fuzz.o ../../mercurial/bdiff.c
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    21
38174
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
    22
bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o fuzzutil-oss-fuzz.o
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    23
	$$CXX $$CXXFLAGS -std=c++17 -I../../mercurial bdiff.cc \
38174
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
    24
	  bdiff-oss-fuzz.o fuzzutil-oss-fuzz.o -lFuzzingEngine -o \
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
    25
	  $$OUT/bdiff_fuzzer
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    26
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    27
x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    28
	$$CC -g -O1 -fsanitize=fuzzer-no-link,address -c \
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    29
	  -o $@ \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    30
	  $<
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    31
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    32
xdiff: xdiff.cc xdiffi.o xprepare.o xutils.o fuzzutil.o
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    33
	$$CXX $$CXXFLAGS -DHG_FUZZER_INCLUDE_MAIN=1 -g -O1 -fsanitize=fuzzer-no-link,address \
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    34
	  -I../../mercurial xdiff.cc \
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    35
	  xdiffi.o xprepare.o xutils.o fuzzutil.o -o xdiff
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    36
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    37
fuzz-x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    38
	$$CC $$CFLAGS -c \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    39
	  -o $@ \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    40
	  $<
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    41
38174
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
    42
xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil-oss-fuzz.o
38173
fa0ddd5e8fff fuzz: extract some common utilities and use modern C++ idioms
Augie Fackler <augie@google.com>
parents: 36765
diff changeset
    43
	$$CXX $$CXXFLAGS -std=c++17 -I../../mercurial xdiff.cc \
38174
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38173
diff changeset
    44
	  fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil-oss-fuzz.o \
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    45
	  -lFuzzingEngine -o $$OUT/xdiff_fuzzer
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    46
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    47
all: bdiff xdiff
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    48
38175
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38174
diff changeset
    49
clean:
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38174
diff changeset
    50
	rm *.o *_fuzzer \
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38174
diff changeset
    51
	  bdiff \
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38174
diff changeset
    52
	  xdiff
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38174
diff changeset
    53
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    54
oss-fuzz: bdiff_fuzzer xdiff_fuzzer
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    55
38175
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38174
diff changeset
    56
.PHONY: all clean oss-fuzz