INCLUDEDIRS:=-I/usr/local/pgsql/include/ -I/usr/java/current/include/ -I/usr/java/current/include/linux
LIBDIRS:=-L/usr/local/pgsql/lib
LIBS:=-lpq -lpthread
CXXFLAGS:=-D_REENTRANT

all: libPGNotify.so java
clean:
	rm -f *.o *.so *.class
distclean: clean
	rm -f *~
java: PGNotify.class

PGNotify.class: PGNotify.java
	javac -classpath . PGNotify.java
	
run: java
	env LD_LIBRARY_PATH="." java -classpath . PGNotify

libPGNotify.so: PGNotify.cpp PGNotify.h
	cc -shared ${CXXFLAGS} ${INCLUDEDIRS} ${LIBDIRS} ${LIBS} \
	       PGNotify.cpp -o libPGNotify.so
