| 1 |
# makefile for harness |
| 2 |
DEBUG_OUT = |
| 3 |
#DEBUG_OUT = -DONIG_DEBUG_PARSE -DONIG_DEBUG_COMPILE |
| 4 |
#DEBUG_OUT = -DONIG_DEBUG_PARSE -DONIG_DEBUG_COMPILE -DONIG_DEBUG_MATCH_COUNTER |
| 5 |
|
| 6 |
SRC = ../src |
| 7 |
CFLAGS = -I$(SRC) -Wall -g -fsanitize=fuzzer,address -fno-omit-frame-pointer |
| 8 |
CFLAGS_M = -I$(SRC) -Wall -g -fsanitize=fuzzer-no-link,address -fno-omit-frame-pointer -DSTANDALONE |
| 9 |
ONIG_LIB = $(SRC)/.libs/libonig.a |
| 10 |
LIBS = $(ONIG_LIB) |
| 11 |
|
| 12 |
TARGETS = fuzzer-encode fuzzer-syntax fuzzer-utf16-be fuzzer-utf16-le \ |
| 13 |
fuzzer-regset \ |
| 14 |
read-encode read-syntax read-utf16-be read-utf16-le read-regset |
| 15 |
|
| 16 |
OTHER_TARGETS = libfuzzer-onig libfuzzer-onig-full fuzzer-deluxe read-deluxe |
| 17 |
|
| 18 |
|
| 19 |
#default: $(TARGETS) |
| 20 |
default: read-syntax |
| 21 |
|
| 22 |
fuzzer-encode: base.c $(ONIG_LIB) |
| 23 |
clang $(CFLAGS) $< $(LIBS) -o $@ |
| 24 |
|
| 25 |
fuzzer-syntax: base.c $(ONIG_LIB) |
| 26 |
clang -DSYNTAX_TEST $(CFLAGS) $< $(LIBS) -o $@ |
| 27 |
|
| 28 |
fuzzer-deluxe: deluxe.c $(ONIG_LIB) |
| 29 |
clang $(CFLAGS) $< $(LIBS) -o $@ |
| 30 |
|
| 31 |
fuzzer-utf16-be: base.c $(ONIG_LIB) |
| 32 |
clang -DUTF16_BE $(CFLAGS) $< $(LIBS) -o $@ |
| 33 |
|
| 34 |
fuzzer-utf16-le: base.c $(ONIG_LIB) |
| 35 |
clang -DUTF16_LE $(CFLAGS) $< $(LIBS) -o $@ |
| 36 |
|
| 37 |
fuzzer-regset: regset.c $(ONIG_LIB) |
| 38 |
clang $(CFLAGS) $< $(LIBS) -o $@ |
| 39 |
|
| 40 |
read-encode: base.c $(ONIG_LIB) |
| 41 |
clang $(CFLAGS_M) $< $(LIBS) -o $@ |
| 42 |
|
| 43 |
read-syntax: base.c $(ONIG_LIB) |
| 44 |
clang -DSYNTAX_TEST $(CFLAGS_M) $< $(LIBS) -o $@ |
| 45 |
|
| 46 |
read-deluxe: deluxe.c $(ONIG_LIB) |
| 47 |
clang $(CFLAGS_M) $< $(LIBS) -o $@ |
| 48 |
|
| 49 |
read-utf16-be: base.c $(ONIG_LIB) |
| 50 |
clang -DUTF16_BE $(CFLAGS_M) $< $(LIBS) -o $@ |
| 51 |
|
| 52 |
read-utf16-le: base.c $(ONIG_LIB) |
| 53 |
clang -DUTF16_LE $(CFLAGS_M) $< $(LIBS) -o $@ |
| 54 |
|
| 55 |
read-regset: regset.c $(ONIG_LIB) |
| 56 |
clang $(CFLAGS_M) $< $(LIBS) -o $@ |
| 57 |
|
| 58 |
libfuzzer-onig: libfuzzer-onig.cpp $(ONIG_LIB) |
| 59 |
clang++ $(CFLAGS) $< $(LIBS) -o $@ |
| 60 |
|
| 61 |
libfuzzer-onig-full: libfuzzer-onig.cpp $(ONIG_LIB) |
| 62 |
clang++ -DFULL_TEST $(CFLAGS) $< $(LIBS) -o $@ |
| 63 |
|
| 64 |
|
| 65 |
$(ONIG_LIB): |
| 66 |
cd ..; make clean |
| 67 |
#cd ..; autoreconf -vfi |
| 68 |
cd ..; ./configure CC=clang LD=clang CFLAGS="-g -fsanitize=address -fno-omit-frame-pointer $(DEBUG_OUT)" LDFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" |
| 69 |
cd ..; make -j4 |
| 70 |
|
| 71 |
|
| 72 |
clean: |
| 73 |
rm -f $(TARGETS) $(OTHER_TARGETS) |