forked from kokke/tiny-regex-c
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
56 lines (46 loc) · 2 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
CC := cc
CFLAGS := -O3 -Wall -Wextra
#CFLAGS := -g -Wall -Wextra -std=c99 -DDEBUG
# Number of random text expressions to generate, for random testing
NRAND_TESTS := 1000
PYTHON != if (python --version 2>&1 | grep -q 'Python 3\..*'); then \
echo 'python'; \
elif command -v python3 >/dev/null 2>&1; then \
echo 'python3'; \
else \
echo 'Error: no compatible python 3 version found.' >&2; \
exit 1; \
fi
TEST_BINS = tests/test1 tests/test2 tests/test_compile tests/test_rand tests/test_rand_neg
all: $(TEST_BINS)
tests/test1: re.c tests/test1.c
@$(CC) -I. $(CFLAGS) re.c tests/test1.c -o $@
tests/test2: re.c tests/test2.c
@$(CC) -I. $(CFLAGS) re.c tests/test2.c -o $@
tests/test_compile: re.c tests/test_compile.c
@$(CC) -I. $(CFLAGS) re.c tests/test_compile.c -o $@
tests/test_rand: re.c tests/test_rand.c
@$(CC) -I. $(CFLAGS) re.c tests/test_rand.c -o $@
tests/test_rand_neg: re.c tests/test_rand_neg.c
@$(CC) -I. $(CFLAGS) re.c tests/test_rand_neg.c -o $@
clean:
@rm -f $(TEST_BINS)
@rm -f a.out
@rm -f *.o
test-pyok: tests/test_rand
@$(test $(PYTHON))
@$(PYTHON) ./scripts/regex_test.py tests/ok.lst $(NRAND_TESTS)
test-pynok: tests/test_rand_neg
@$(test $(PYTHON))
@$(PYTHON) ./scripts/regex_test_neg.py tests/nok.lst $(NRAND_TESTS)
test: all
@./tests/test1
$(MAKE) test-pyok
$(MAKE) test-pynok
@./tests/test_compile
@./tests/test2
CBMC := cbmc
# unwindset: loop max MAX_REGEXP_OBJECTS patterns
# --enum-range-check not with cbmc 5.10 on ubuntu-latest
verify:
$(CBMC) -DCPROVER --unwindset 8 --unwind 16 --depth 16 --bounds-check --pointer-check --memory-leak-check --div-by-zero-check --signed-overflow-check --unsigned-overflow-check --pointer-overflow-check --conversion-check --undefined-shift-check $(CBMC_ARGS) re.c