title: Creating makefile with pthreads
body: <p>I want to create a makefile that supports posix semaphores.
  That is what I've got so far:</p>
  
  <pre><code>CFLAGS=-g -ansi -pedantic -Wall -Werror -D_XOPEN_SOURCE=600
  LDFLAGS=-pthread 
  CC=gcc
  OBJECTS=MsgQueueMain.o MsgQueue.o Queue.o MyMalloc.o
  TARGET=MsgQueueMain
  
  all: $(TARGET)
  
  $(TARGET): $(OBJECTS)
      $(CC) $(OBJECTS) -o $@
  
  include depends
  
  depends:
      $(CC) -MM $(OBJECTS:.o=.c) &gt; depends
  
  clean:
      rm ./$(TARGET) *.o
  </code></pre>
  
  <p>For some reason, I'm getting "undefined reference" for all calls to semaphore.h api functions.</p>