summaryrefslogtreecommitdiff
path: root/harnesses/makefile
blob: b32429550405fdf514800e1944c75bf50a666586 (plain)
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
# makefile for harness
SRC = ../src
CFLAGS   = -I$(SRC) -Wall -g -fsanitize=fuzzer,address -fno-omit-frame-pointer
CFLAGS_M = -I$(SRC) -Wall -g -fsanitize=fuzzer-no-link,address -fno-omit-frame-pointer -DSTANDALONE
ONIG_LIB = $(SRC)/.libs/libonig.a
LIBS     = $(ONIG_LIB)

TARGETS = fuzzer-encode fuzzer-syntax fuzzer-utf16-be fuzzer-utf16-le \
          fuzzer-regset \
          read-encode read-syntax read-utf16-be read-utf16-le read-regset

OTHER_TARGETS = libfuzzer-onig libfuzzer-onig-full fuzzer-deluxe read-deluxe


default: $(TARGETS)

fuzzer-encode: base.c $(ONIG_LIB)
	clang $(CFLAGS) $< $(LIBS) -o $@

fuzzer-syntax: base.c $(ONIG_LIB)
	clang -DSYNTAX_TEST $(CFLAGS) $< $(LIBS) -o $@

fuzzer-deluxe: deluxe.c $(ONIG_LIB)
	clang $(CFLAGS) $< $(LIBS) -o $@

fuzzer-utf16-be: base.c $(ONIG_LIB)
	clang -DUTF16_BE $(CFLAGS) $< $(LIBS) -o $@

fuzzer-utf16-le: base.c $(ONIG_LIB)
	clang -DUTF16_LE $(CFLAGS) $< $(LIBS) -o $@

fuzzer-regset: regset.c $(ONIG_LIB)
	clang $(CFLAGS) $< $(LIBS) -o $@

read-encode: base.c $(ONIG_LIB)
	clang $(CFLAGS_M) $< $(LIBS) -o $@

read-syntax: base.c $(ONIG_LIB)
	clang -DSYNTAX_TEST $(CFLAGS_M) $< $(LIBS) -o $@

read-deluxe: deluxe.c $(ONIG_LIB)
	clang $(CFLAGS_M) $< $(LIBS) -o $@

read-utf16-be: base.c $(ONIG_LIB)
	clang -DUTF16_BE $(CFLAGS_M) $< $(LIBS) -o $@

read-utf16-le: base.c $(ONIG_LIB)
	clang -DUTF16_LE $(CFLAGS_M) $< $(LIBS) -o $@

read-regset: regset.c $(ONIG_LIB)
	clang $(CFLAGS_M) $< $(LIBS) -o $@

libfuzzer-onig: libfuzzer-onig.cpp $(ONIG_LIB)
	clang++ $(CFLAGS) $< $(LIBS) -o $@

libfuzzer-onig-full: libfuzzer-onig.cpp $(ONIG_LIB)
	clang++ -DFULL_TEST $(CFLAGS) $< $(LIBS) -o $@


$(ONIG_LIB):
	cd ..; make clean
	#cd ..; autoreconf -vfi
	cd ..; ./configure CC=clang LD=clang CFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-g -fsanitize=address -fno-omit-frame-pointer"
	cd ..; make -j4


clean:
	rm -f $(TARGETS) $(OTHER_TARGETS)