title: What is wrong with this Makefile? (header files not found)
body: <p>I am modifying an old makefile in order to build a C extension for postgreSQL. The Makefile currently looks like this:</p>
  
  <pre><code>PGLIB = /usr/lib/postgresql/8.4/lib
  PQINC = /usr/include/postgresql/8.4/server        
  CC=gcc
  
  override CFLAGS+= $(CFLAGS_SL) -DPG_AGGREGATE 
  
  SHLIB = pg_myextlib
  
  SRC =  foo.c \
         foobar.c
  
  OBJS = foo.o \       
         foobar.o
  
  all: $(OBJS)
      $(CC) -shared -o $(SHLIB)$(DLSUFFIX) $(OBJS) -I$(PQINC)
      cp *.so $(PGLIB)
  
  clean:
      rm -f $(SHLIB) $(OBJS) 
  </code></pre>
  
  <p>The error I get when I run make is:</p>
  
  <blockquote>
    <p>common.h:58:22: error: postgres.h: No such file or directory</p>
  </blockquote>
  
  <p>Which suggests that the include path is not being added (the file exists in $PQINC).
  Its a long time since I wrote the Makefile - and I haven't written many since. As an aside, I am pretty sure that 'shared' is not the gcc flag to build shared libs on Ubuntu (my current dev box) - I think the flag should be 'fPIC' - can someone confirm this?</p>
  
  <p>I am runing gcc v4.4.3 on Ubuntu 10.0.4 and compiling for use with PG 8.4</p>