-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (39 loc) · 1.4 KB
/
Makefile
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
51
CC=cc -std=c99
RM=rm -f
RMDIR=rm -rf
AR=ar cru
RANLIB=ranlib
MKDIR=mkdir -p
CP=cp
GIT_CLONE=git clone
CFLAGS=-Wall -W -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wswitch-default -Wswitch-enum -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-overflow=5 -Wstrict-prototypes -Winline -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wunreachable-code -Wlogical-op -Wstrict-aliasing=2 -Wredundant-decls -Wold-style-definition -Wno-unused-function -ftrapv -g
CPPFLAGS=-Imlib
LDFLAGS=
MLIB_URL=https://github.com/P-p-H-d/mlib.git
all: mjsonlib.a
mjsonlib.a: mjsonlib.o
$(AR) mjsonlib.a mjsonlib.o
$(RANLIB) mjsonlib.a
mjsonlib.o: mjsonlib.c mjsonlib.h mlib
mlib:
$(GIT_CLONE) $(MLIB_URL)
clean:
$(RM) *~ *.o *.a test.exe test-afl.exe
$(RMDIR) mlib
$(RMDIR) afl-out
$(RMDIR) afl-in
check: test.exe
./test.exe
test: check
test.exe: test.c mjsonlib.a
$(CC) $(CFLAGS) test.c mjsonlib.a -o test.exe
test-afl.exe: test-afl.c mjsonlib.c mlib
afl-gcc -std=c99 -O2 -g $(CPPFLAGS) test-afl.c mjsonlib.c -o test-afl.exe
afl: test-afl.exe
$(MKDIR) afl-out
$(MKDIR) afl-in
$(CP) test.json afl-in
afl-fuzz -i afl-in -o afl-out -M fuzzer01 -- ./test-afl.exe
afl-slave:
test -d ./afl-out/fuzzer01 || exit 1
for i in $$(seq 2 $$(LANG=C lscpu |grep "CPU(s)"|head -1|awk ' { print $$2 }')) ; do xterm -e afl-fuzz -i afl-in -o afl-out -M fuzzer0$${i} -- ./test-afl.exe & done