Automatic generation of (M|m)akefiles makes me worry about what you're trying to do here.
Do you understand what goes on under the covers when you type make? Or gmake? I'm only asking because if you don't when things break, such as new code changes not being incorporated into the build, you'll have difficulties trying to work what has happened.
To start to understand make, can I suggest having a read of "Managing Projects with GNU Make" by Robert Mecklenberg. The early chapters cover how make is working. Getting your heard around the fact that make is backward chaining is one of the biggest things you can do.
If you don't, and your system appears to work, then you'll be, to use The Pragmatic Programmers' term, "programming by coincidence". (-:
BTW Great articles available at their site! And I'm not involved with them. YMMV. Yada-yada...