title: Communicate changes to top-level Makefile
body: <p>I have a top-level Makefile that is recursively calling a sub-level makefile. Because of this, the sub-Makefile is defined as a <code>.PHONY</code> target:</p>
  <pre><code>top-target: sub-target
      some commands
  
  .PHONY: sub-target
  sub-target:
      $(MAKE) -C dir/to/sub/makefile
  </code></pre>
  <p>Because of this, <code>top-target</code> is always built regardless of whether if <code>sub-target</code> changed or not. Is there a way to communicate whether if the <code>sub-target</code> changed?</p>
  <p>One thing I can do is remove <code>sub-target</code> as a <code>.PHONY</code> and use some kind of stamp, but <code>sub-target</code> has its own dependencies and a simple stamp could cause false positive builds. Unless I manually move the entire <code>sub-target</code> Makefile into the top-level Makefile, it'd be difficult to achieve.</p>