1CLANG ?= clang
2GCC ?= gcc
3
4KLEE_INCLUDE = /home/klee/klee_src/include
5KLEE_LIB = /home/klee/klee_build/lib
6
7CPPFLAGS += -I$(KLEE_INCLUDE)
8CFLAGS += -g -O0 -Xclang -disable-O0-optnone
9
10main.bc: main.c busybox.h util-linux.h
11# Binary for replying generated test inputs (for debugging etc.).
12# See: https://klee.github.io/tutorials/testing-function/#replaying-a-test-case
13main: main.c busybox.h util-linux.h
14 $(GCC) $(CPPFLAGS) -g3 -L$(KLEE_LIB) $< -o $@
15
16%.bc: %.c
17 $(CLANG) -emit-llvm -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
18
19sim: main.bc
20 klee --solver-backend=z3 \
21 --optimize \
22 --max-memory=$(shell expr 1024 \* 1024 \* 1024) \
23 --exit-on-error \
24 --libc=uclibc \
25 --posix-runtime \
26 $<
27
28clean:
29 rm -f main main.bc
30
31.PHONY: sim clean