Show More
@@ -1,165 +1,141 | |||
|
1 | 1 | CC = clang |
|
2 | 2 | CXX = clang++ |
|
3 | 3 | |
|
4 | 4 | # By default, use our own standalone_fuzz_target_runner. |
|
5 | 5 | # This runner does no fuzzing, but simply executes the inputs |
|
6 | 6 | # provided via parameters. |
|
7 | 7 | # Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a" |
|
8 | 8 | # to link the fuzzer(s) against a real fuzzing engine. |
|
9 | 9 | # |
|
10 | 10 | # OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE. |
|
11 | 11 | LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o |
|
12 | 12 | |
|
13 | 13 | PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config |
|
14 | 14 | |
|
15 | 15 | CXXFLAGS += -Wno-deprecated-register |
|
16 | 16 | |
|
17 | 17 | all: standalone_fuzz_target_runner.o oss-fuzz |
|
18 | 18 | |
|
19 | 19 | standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cc |
|
20 | 20 | |
|
21 | 21 | pyutil.o: pyutil.cc pyutil.h |
|
22 | 22 | $(CXX) $(CXXFLAGS) -g -O1 \ |
|
23 | 23 | `$(PYTHON_CONFIG) --cflags` \ |
|
24 | 24 | -I../../mercurial -c -o pyutil.o pyutil.cc |
|
25 | 25 | |
|
26 | 26 | bdiff-oss-fuzz.o: ../../mercurial/bdiff.c |
|
27 | 27 | $(CC) $(CFLAGS) -c -o bdiff-oss-fuzz.o ../../mercurial/bdiff.c |
|
28 | 28 | |
|
29 | 29 | bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o |
|
30 | 30 | $(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial bdiff.cc \ |
|
31 | 31 | bdiff-oss-fuzz.o $(LIB_FUZZING_ENGINE) -o \ |
|
32 | 32 | $$OUT/bdiff_fuzzer |
|
33 | 33 | |
|
34 | 34 | mpatch.o: ../../mercurial/mpatch.c |
|
35 | 35 | $(CC) -g -O1 -fsanitize=fuzzer-no-link,address -c -o mpatch.o \ |
|
36 | 36 | ../../mercurial/mpatch.c |
|
37 | 37 | |
|
38 | 38 | mpatch-oss-fuzz.o: ../../mercurial/mpatch.c |
|
39 | 39 | $(CC) $(CFLAGS) -c -o mpatch-oss-fuzz.o ../../mercurial/mpatch.c |
|
40 | 40 | |
|
41 | 41 | mpatch_fuzzer: mpatch.cc mpatch-oss-fuzz.o |
|
42 | 42 | $(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial mpatch.cc \ |
|
43 | 43 | mpatch-oss-fuzz.o $(LIB_FUZZING_ENGINE) -o \ |
|
44 | 44 | $$OUT/mpatch_fuzzer |
|
45 | 45 | |
|
46 | 46 | mpatch_corpus.zip: |
|
47 | 47 | python mpatch_corpus.py $$OUT/mpatch_fuzzer_seed_corpus.zip |
|
48 | 48 | |
|
49 | 49 | fuzz-x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h |
|
50 | 50 | $(CC) $(CFLAGS) -c \ |
|
51 | 51 | -o $@ \ |
|
52 | 52 | $< |
|
53 | 53 | |
|
54 | 54 | xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o |
|
55 | 55 | $(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial xdiff.cc \ |
|
56 | 56 | fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o \ |
|
57 | 57 | $(LIB_FUZZING_ENGINE) -o $$OUT/xdiff_fuzzer |
|
58 | 58 | |
|
59 |
|
|
|
60 |
$(CC) |
|
|
61 | -I../../mercurial \ | |
|
62 | -c -o manifest.o ../../mercurial/cext/manifest.c | |
|
63 | ||
|
64 | charencode.o: ../../mercurial/cext/charencode.c | |
|
65 | $(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \ | |
|
66 | -I../../mercurial \ | |
|
67 | -c -o charencode.o ../../mercurial/cext/charencode.c | |
|
68 | ||
|
69 | parsers.o: ../../mercurial/cext/parsers.c | |
|
70 | $(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \ | |
|
71 | -I../../mercurial \ | |
|
72 | -c -o parsers.o ../../mercurial/cext/parsers.c | |
|
59 | parsers-%.o: ../../mercurial/cext/%.c | |
|
60 | $(CC) -I../../mercurial `$(PYTHON_CONFIG) --cflags` $(CFLAGS) -c \ | |
|
61 | -o $@ $< | |
|
73 | 62 | |
|
74 | dirs.o: ../../mercurial/cext/dirs.c | |
|
75 | $(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \ | |
|
76 | -I../../mercurial \ | |
|
77 | -c -o dirs.o ../../mercurial/cext/dirs.c | |
|
63 | PARSERS_OBJS=parsers-manifest.o parsers-charencode.o parsers-parsers.o parsers-dirs.o parsers-pathencode.o parsers-revlog.o | |
|
78 | 64 | |
|
79 | pathencode.o: ../../mercurial/cext/pathencode.c | |
|
80 | $(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \ | |
|
81 | -I../../mercurial \ | |
|
82 | -c -o pathencode.o ../../mercurial/cext/pathencode.c | |
|
83 | ||
|
84 | revlog.o: ../../mercurial/cext/revlog.c | |
|
85 | $(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \ | |
|
86 | -I../../mercurial \ | |
|
87 | -c -o revlog.o ../../mercurial/cext/revlog.c | |
|
88 | ||
|
89 | dirs_fuzzer: dirs.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o | |
|
65 | dirs_fuzzer: dirs.cc pyutil.o $(PARSERS_OBJS) | |
|
90 | 66 | $(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \ |
|
91 | 67 | -Wno-register -Wno-macro-redefined \ |
|
92 | 68 | -I../../mercurial dirs.cc \ |
|
93 | manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ | |
|
69 | pyutil.o $(PARSERS_OBJS) \ | |
|
94 | 70 | $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \ |
|
95 | 71 | -o $$OUT/dirs_fuzzer |
|
96 | 72 | |
|
97 | fncache_fuzzer: fncache.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o | |
|
73 | fncache_fuzzer: fncache.cc | |
|
98 | 74 | $(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \ |
|
99 | 75 | -Wno-register -Wno-macro-redefined \ |
|
100 | 76 | -I../../mercurial fncache.cc \ |
|
101 | manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ | |
|
77 | pyutil.o $(PARSERS_OBJS) \ | |
|
102 | 78 | $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \ |
|
103 | 79 | -o $$OUT/fncache_fuzzer |
|
104 | 80 | |
|
105 | jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o | |
|
81 | jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc pyutil.o $(PARSERS_OBJS) | |
|
106 | 82 | $(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \ |
|
107 | 83 | -Wno-register -Wno-macro-redefined \ |
|
108 | 84 | -I../../mercurial jsonescapeu8fast.cc \ |
|
109 | manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ | |
|
85 | pyutil.o $(PARSERS_OBJS) \ | |
|
110 | 86 | $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \ |
|
111 | 87 | -o $$OUT/jsonescapeu8fast_fuzzer |
|
112 | 88 | |
|
113 | 89 | manifest_corpus.zip: |
|
114 | 90 | python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip |
|
115 | 91 | |
|
116 | manifest_fuzzer: manifest.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o | |
|
92 | manifest_fuzzer: manifest.cc pyutil.o $(PARSERS_OBJS) | |
|
117 | 93 | $(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \ |
|
118 | 94 | -Wno-register -Wno-macro-redefined \ |
|
119 | 95 | -I../../mercurial manifest.cc \ |
|
120 | manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ | |
|
96 | pyutil.o $(PARSERS_OBJS) \ | |
|
121 | 97 | $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \ |
|
122 | 98 | -o $$OUT/manifest_fuzzer |
|
123 | 99 | |
|
124 | revlog_fuzzer: revlog.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o | |
|
100 | revlog_fuzzer: revlog.cc pyutil.o $(PARSERS_OBJS) | |
|
125 | 101 | $(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \ |
|
126 | 102 | -Wno-register -Wno-macro-redefined \ |
|
127 | 103 | -I../../mercurial revlog.cc \ |
|
128 | manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ | |
|
104 | pyutil.o $(PARSERS_OBJS) \ | |
|
129 | 105 | $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \ |
|
130 | 106 | -o $$OUT/revlog_fuzzer |
|
131 | 107 | |
|
132 | 108 | revlog_corpus.zip: |
|
133 | 109 | python revlog_corpus.py $$OUT/revlog_fuzzer_seed_corpus.zip |
|
134 | 110 | |
|
135 | dirstate_fuzzer: dirstate.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o | |
|
111 | dirstate_fuzzer: dirstate.cc pyutil.o $(PARSERS_OBJS) | |
|
136 | 112 | $(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \ |
|
137 | 113 | -Wno-register -Wno-macro-redefined \ |
|
138 | 114 | -I../../mercurial dirstate.cc \ |
|
139 | manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ | |
|
115 | pyutil.o $(PARSERS_OBJS) \ | |
|
140 | 116 | $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \ |
|
141 | 117 | -o $$OUT/dirstate_fuzzer |
|
142 | 118 | |
|
143 | 119 | dirstate_corpus.zip: |
|
144 | 120 | python dirstate_corpus.py $$OUT/dirstate_fuzzer_seed_corpus.zip |
|
145 | 121 | |
|
146 | fm1readmarkers_fuzzer: fm1readmarkers.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o | |
|
122 | fm1readmarkers_fuzzer: fm1readmarkers.cc pyutil.o $(PARSERS_OBJS) | |
|
147 | 123 | $(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \ |
|
148 | 124 | -Wno-register -Wno-macro-redefined \ |
|
149 | 125 | -I../../mercurial fm1readmarkers.cc \ |
|
150 | manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ | |
|
126 | pyutil.o $(PARSERS_OBJS) \ | |
|
151 | 127 | $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \ |
|
152 | 128 | -o $$OUT/fm1readmarkers_fuzzer |
|
153 | 129 | |
|
154 | 130 | fm1readmarkers_corpus.zip: |
|
155 | 131 | python fm1readmarkers_corpus.py $$OUT/fm1readmarkers_fuzzer_seed_corpus.zip |
|
156 | 132 | |
|
157 | 133 | clean: |
|
158 | 134 | $(RM) *.o *_fuzzer \ |
|
159 | 135 | bdiff \ |
|
160 | 136 | mpatch \ |
|
161 | 137 | xdiff |
|
162 | 138 | |
|
163 | 139 | oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer dirs_fuzzer fncache_fuzzer jsonescapeu8fast_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer fm1readmarkers_corpus.zip |
|
164 | 140 | |
|
165 | 141 | .PHONY: all clean oss-fuzz |
General Comments 0
You need to be logged in to leave comments.
Login now