title: Why does .PHONY not work in this situation?
body: <p>I have a complicated makefile that seems to relink my libraries and executables every time I invoke it.  I was able to narrow down the problem into a simple makefile:</p>
  
  <pre><code> 1: all: prog
   2:
   3: .PHONY: prog
   4: prog: prog.exe
   5:
   6: prog.exe: lib prog.o
   7:         touch prog.exe
   8:
   9: prog.o: prog.c
  10:         touch prog.o
  11:
  12: .PHONY: lib
  13: lib: lib.so
  14:
  15: lib.so: lib.o
  16:         touch lib.so
  17:
  18: lib.o: lib.c
  19:         touch lib.o
  20:
  21: .PHONY: clean
  22: clean:
  23:         rm *.so *.o *.exe
  </code></pre>
  
  <p>For some reason, this example, prog.exe is created every time.  If I replace the lib on line 6 with lib.so then it works.  Yet it seems like I should be able to do what I'm attempting here.  Is there something fundamental I'm missing?</p>