-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
81 lines (65 loc) · 1.98 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# A simple makefile to build my project.
#
# Connor Shugg
CC=clang
# Include variables (CHANGE THESE IF/WHEN NEEDED)
AFLPP_INCLUDE=~/fuzzing/afl/AFLplusplus/include
MEMCHECK_INCLUDE=~/workspace/fuzzing/memcheck_include
# output file names
MUTATOR_BINARY=gurthang-mutator.so
PRELOAD_BINARY=gurthang-preload.so
COMUX_BINARY=comux-tool
# test variables
TEST_BINARY=mtest
TEST=you_need_to_specify_a_C_source_test_file
# compilation variables
CFLAGS=-g -Wall
PRELOAD_CFLAGS=-g -Wall -fPIC -shared
PRELOAD_LDLIBS=-ldl
# other variables
C_NONE="\\033[0m"
C_ACCENT1="\\033[33m"
C_ACCENT2="\\033[35m"
# source files
SRC_DIR=./src
UTILS_DIR=$(SRC_DIR)/utils
COMUX_DIR=$(SRC_DIR)/comux
default: all
# Build both libraries: the mutator and the preload library
all: mutator preload comux-toolkit
# Build the mutator shared library
mutator:
@ echo -e "$(C_ACCENT1)Building mutator library$(C_NONE)"
$(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -O3 -fPIC -shared -g \
-I $(AFLPP_INCLUDE) \
$(SRC_DIR)/mutator.c $(UTILS_DIR)/*.c $(COMUX_DIR)/comux.c \
-o $(MUTATOR_BINARY)
mutator-memcheck:
@ echo -e "$(C_ACCENT1)Building mutator library.$(C_NONE) $(C_ACCENT2)(for memcheck)$(C_NONE)"
$(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -O3 -fPIC -shared -g \
-I $(AFLPP_INCLUDE) -I $(MEMCHECK_INCLUDE) \
$(SRC_DIR)/mutator.c $(UTILS_DIR)/*.c $(COMUX_DIR)/comux.c \
-o $(MUTATOR_BINARY)
# Build the LD_PRELOAD shared library
preload:
@ echo -e "$(C_ACCENT1)Building preload library.$(C_NONE)"
$(CC) $(PRELOAD_CFLAGS) \
$(SRC_DIR)/preload.c $(UTILS_DIR)/*.c $(COMUX_DIR)/comux.c \
-o $(PRELOAD_BINARY) \
$(PRELOAD_LDLIBS)
comux-toolkit:
@ echo -e "$(C_ACCENT1)Building comux toolkit.$(C_NONE)"
$(CC) -g $(CFLAGS) \
$(UTILS_DIR)/*.c $(COMUX_DIR)/*.c \
-o $(COMUX_BINARY)
# Build a test
test:
$(CC) $(CFLAGS) -g -o $(TEST_BINARY) $(TEST) \
$(UTILS_DIR)/*.c $(COMUX_DIR)/comux.c
# Clean up extra junk
clean:
rm -f $(MUTATOR_BINARY)
rm -f $(PRELOAD_BINARY)
rm -f $(COMUX_BINARY)
rm -f $(TEST_BINARY)
rm -f *.txt