SPLC ?= ../../cfa/splc
TESLA_CLANG ?= ../../kernel/tesla-clang
OPTLEVEL ?= -O0
CC = $(TESLA_CLANG)

CFLAGS=-Wall -g -I../.. -I. $(OPTLEVEL)

TESLALIBS=                                \
	../../libtesla/tesla_state.o            \
	../../libtesla/tesla_state_global.o     \
	../../libtesla/tesla_state_perthread.o  \
	../../libtesla/tesla_util.o

.PHONY: all clean
all: example2

example2_automata.c example2_defs.h: example2.spl
	$(SPLC) -t tesla -s example2 example2.spl

example2_assert.o: example2_assert.c
	$(CC) -c $(CFLAGS) -o $@ $<

example2_automata.o: example2_automata.c example2_defs.h
	$(CC) -c $(CFLAGS) -o $@ $<

example2: example2_automata.o example2_assert.o example2.o ${TESLALIBS}
	$(CC) -o $@ $^

clean:
	rm -f example2 *.o