Making an XML bill of materials in GNU Make


because since the rule for foo didn't have any commands SHELL was not expanded and hence the hack didn't work.   Here's the XML in that case:


  <rule target="all">


      <rule target="foo" />

      <rule target="bar" />



  <rule target="foo" />

  <rule target="bar" />


To workaround this the foo: baz can be modified to include a useful command:

foo: baz ; @true

and the correct results will be generated.


This is a simple technique that can provide useful information from the Make.  It isn't as flexible as some commercial tools that can provide detailed information about the commands run, and even timing information, but as a Makefile debugging aid it's simple to implement and provides insight that hard to obtain otherwise.

About the author

AgileConnection is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.