title: Makefile .cpp.o: vs %o: %.cpp
body: <p>In make, what is the difference between:</p>
  
  <pre><code>%.o: %.cpp foolib.h
      $(CXX) -c $&lt; -o $@ $(CXXFLAGS)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>.cpp.o: foolib.h
      $(CXX) -c $&lt; -o $@ $(CXXFLAGS)
  </code></pre>
  
  <p>?</p>
  
  <p>Also, am I right in understanding that <code>foolib.h</code> should be included in the rules as shown above if the changes made in the header are to be (re)compiled even when there is no change in the .cpp files?</p>