Here's what I have: CC=gcc COPTS=-D_REENTRANT -O2 -fPIC -shared -I$(PGINC) -I$(NSHOME)/include -I$(PREFIX)/include LDFLAGS=-b But, I have to manually run ld: ld -b -o postgres.sl postgres.o ~/psql/lib/libpq.sl