SHELL=/bin/sh
CFG=`which mysql_config`
CFLAGS=-g -O0 -pipe -fpic -Wall -pedantic -std=c99
MYSQL_LIBS:=$(shell $(CFG) --libs)
MYSQL_FLAGS:=$(shell $(CFG) --cflags)
LIBS=-lpslib

objects=test.o psleak.o psDB.o

all: psdb

test: psdb test-bin
	LD_LIBRARY_PATH=. ./test
     
test-bin: test.o
	$(CC) $(CFLAGS) -o test -L./ -lpsdb

psdb: $(objects)
	$(CC) $(CFLAGS) -shared -o libpsdb.so $(objects) $(LIBS) $(MYSQL_FLAGS) $(MYSQL_LIBS)

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

clean:
	$(RM) *.so *.o core
