-
Notifications
You must be signed in to change notification settings - Fork 1
/
pullAndBuild.sh
53 lines (42 loc) · 1.29 KB
/
pullAndBuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -x
set -e
# This small script pulls the latest version of afl-fuzz and cppcheck
# and builds the executables from:
# - afl-fuzz
# - cppcheck (instrumented by afl-clang++)
# - fuzzer-cli (instrumented by afl-clang++)
# Determine the current working directory
WORKINGDIR=$(dirname $(readlink -f "$0"))
CPU_CORES_ON_SYSTEM=$(eval "/usr/bin/nproc")
AFL_GPP=../afl/afl-clang++
# Update afl-sources and build
git pull
cd "$WORKINGDIR"/afl
git stash
git pull
make clean
make all -j"$CPU_CORES_ON_SYSTEM" CXX=clang++ CC=clang
# Update cppcheck-sources and build
cd "$WORKINGDIR"/cppcheck
git stash
git pull
make clean
make CXX=${AFL_GPP} -j"$CPU_CORES_ON_SYSTEM"
# Update cppcheck-sources and build with address sanitizer
cd "$WORKINGDIR"/cppcheck_asan
git stash
git pull
make clean
make CXX=${AFL_GPP} CXXFLAGS="-fsanitize=address -fno-sanitize-recover=all -Og -g3" -j"$CPU_CORES_ON_SYSTEM"
# Update cppcheck-sources and build with undefined sanitizer
cd "$WORKINGDIR"/cppcheck_usan
git stash
git pull
make clean
make CXX=${AFL_GPP} CXXFLAGS="-fsanitize=undefined -fno-sanitize-recover=all -Og -g3" -j"$CPU_CORES_ON_SYSTEM"
# Build fuzzer-cli executable
cd "$WORKINGDIR"/fuzzer-cli/
make CXX=${AFL_GPP} CXXFLAGS="-static -O1" clean all
# Return back to previous directory
cd "$WORKINGDIR"