SHELL=/bin/sh
CFG=/usr/bin/mysql_config
CFLAGS=-g -O0 -pipe -fpic -Wall -pedantic -std=c99 -L/usr/local/lib -I/usr/local/include
MYLIBS:=$(shell $(CFG) --libs)
MYFLAGS:=$(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) $(MYFLAGS) $(MYLIBS)

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

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