INCPATH =

CFLAGS  = -fprofile-arcs -ftest-coverage -pg -g -O0 -Wall $(INCPATH) -DDEBUG -g

PLSLIB=libpls.a
LIBOBJS=pls.o
TESTOBJS=test.o
LIBS=-L. -lpls
COV=pls.gcov

.SUFFIXES: .c .gcov

all: $(PLSLIB)

$(PLSLIB):  $(LIBOBJS)
	ar cru $@ $(LIBOBJS)
	ranlib $@

coverage: $(COV)

test: $(PLSLIB) $(TESTOBJS)
	rm -f $@
	$(CC) -o $@ $(TESTOBJS) $(LIBS)

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

.c.gcov:
	gcov $<

install: all

clean:
	 rm -f  *.o *.bb *.bbg *.da *.gcov *~ $(PLSLIB) test test.exe

preexport:
	grep -v -e '/\*\*' pls.c > pls.c.export && mv -f pls.c.export pls.c
	grep -v -e '/\*\*' test.c > test.c.export && mv -f test.c.export test.c

run: test
	./test
