1#
2# Copyright 2022 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at:
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17efuzz_src += \
18    $(FUZZ_DIR)/efuzz.cc
19
20efuzz_lib += liblc3
21efuzz_ldlibs += m
22
23$(eval $(call add-bin,efuzz))
24
25
26dfuzz_src += \
27    $(FUZZ_DIR)/dfuzz.cc
28
29dfuzz_lib += liblc3
30dfuzz_ldlibs += m
31
32$(eval $(call add-bin,dfuzz))
33
34
35.PHONY: fuzz dfuzz efuzz
36
37efuzz dfuzz: CC  = clang
38efuzz dfuzz: CXX = clang++
39efuzz dfuzz: LD  = clang
40
41FUZZER_SANITIZE := -fsanitize=fuzzer,address
42efuzz dfuzz: CFLAGS   += $(FUZZER_SANITIZE)
43efuzz dfuzz: CXXFLAGS += $(FUZZER_SANITIZE)
44efuzz dfuzz: LDFLAGS  += $(FUZZER_SANITIZE)
45
46dfuzz:
47	$(V)$(dfuzz_bin) -runs=1000000
48
49efuzz:
50	$(V)$(efuzz_bin) -runs=1000000
51
52fuzz: efuzz dfuzz
53