Easy Makefiles

October 8, 2007

Here’s a handy g++ option that will let you make up accurate makefiles in a jiffy, -MM.

Run that on your source directory and you’ll get a makefile style list of includes. If it doesn’t work, make sure you add in your compile time defines (like -D_x86 -D_LINUX). This won’t actually check that you need the files you have included, it just makes a list of the ones you have included.

I like to add a sed line to make breaks between source files, like so.

It’s very literal though, so if you do "../StaticDevice.h" type includes, watch out for double entries.

Categories: Geek
Tags: , ,

Leave A Comment

Your email will not be published.