Fix Makefile and debian packaging

based on work done with pgfincore and upstream fixes in PostgreSQL