title: gdb and valgrind within a makefile
body: <p>I have a very basic question. I did look around like over here <a href="http://www.cs.cmu.edu/~gilpin/tutorial/" rel="nofollow">http://www.cs.cmu.edu/~gilpin/tutorial/</a> but still doubtfull..</p>
  
  <p>Consider the following makefile(had also given it in a previous question)</p>
  
  <pre><code>all: clients.so simulator backup  
     LD_PRELOAD=/home/Juggler/client/clients.so ./simulator  
  backup: backup.c libclient.a
     gcc backup.c -o backup -L /home/Juggler/client -L. -lclient -ldl 
  simulator: simulator.c libclient.a     
     gcc -g simulator.c -o simulator -L /home/Juggler/client -L. -lclient -ldl -pthread
  libclient.a: libclient.o client.o     
     ar rcs libclient.a libclient.o client.o 
  libclient.o:libclient.c
     gcc -c libclient.c -o libclient.o -pthread  
  clients.so: client.o client_invoke.o     
     ld -shared -o clients.so client_invoke.o client.o -ldl 
  client_invoke.o: client_invoke.c     
     gcc -Wall -fPIC -DPIC -c -g client_invoke.c 
  client.o: client.c
     gcc -Wall -fPIC -DPIC -c -g client.c -ldl -pthread 
  </code></pre>
  
  <p>What do I do/change to debug using either gdb or valgrind. Actually I am getting a segmentation fault while doing make and would like to debug. But I have never used gdb or valgrind from within a makefile</p>
  
  <p>Thanks</p>