SOURCES=test-abbrev.c kstring.c
BINARIES=test-abbrev test-full

CFLAGS = -std=c99 -Wall $(OPT)
CXXFLAGS = -std=c++11 -Wall $(OPT)

all: $(BINARIES)

memcheck: test-full
	valgrind --tool=memcheck --child-silent-after-fork=yes ./test-full

clean:
	-rm $(BINARIES) $(SOURCES:.c=.o)

test-abbrev: test-abbrev.o kstring.o
	$(CXX) $(CXXFLAGS) -o $@ $^

test-full: test-full.o kstring.o
	$(CXX) $(CXXFLAGS) -o $@ $^

%.o: %.c kstring.h
	$(CC) $(CFLAGS) -c -o $@ $<

%.o: %.cc kstring.h
	$(CXX) $(CXXFLAGS) -c -o $@ $<

%.o: %.cpp kstring.h
	$(CXX) $(CXXFLAGS) -c -o $@ $<
