Can I have one makefile to build a hierarchical project?

Posted by saramah on Stack Overflow See other posts from Stack Overflow or by saramah
Published on 2010-03-17T18:09:10Z Indexed on 2010/03/17 18:11 UTC
Read the original article Hit count: 286

Filed under:
|
|

I have several hundred files in a non-flat directory structure. My Makefile lists each sourcefile, which, given the size of the project and the fact that there are multiple developers on the project, can create annoyances when we forget to put a new one in or take out the old ones. I'd like to generalize my Makefile so that make can simply build all .cpp and .h files without me having to specify all the filenames, given some generic rules for different types of files.

My question: given a large number of files in a directory with lots of subfolders, how do I tell make to build them all without having to specify each and every subfolder as part of the path? And how do I make it so that I can do this with only one Makefile in the root directory?

© Stack Overflow or respective owner

Related posts about makefile

Related posts about build