How many "l"s can you find in:
Q: Make: Greedy search for sources vs. a more selective approach... or a hybrid? I rewrote my makefile a while back to get the benefit of greedily searching for and compiling all sources under some root folder. I'm very happy with it except for the fact that the source libraries I include as submodules tend to have a lot of junk files, e.g. examples, tests, or other sources I don't need... and the make process chokes on these. This is where I am at currently.
So I've come back around to seeing why it can be better to explicitly list sources. The problem with that is that one must always remember to amend the Makefile whenever new sources are added to the tree. That's tedious, and the reason I went initially with the above.
I'm now beginning to wonder if there isn't some method to allow a mix of the two. For example, what if certain folders had a manifest in them that specified certain files to compile, while other folders without a manifest caused the makefile to default to "compile all herein"? 
I'm newish to make, so does this sound wise or unwise? Advice on how to set it up? Pitfalls?
P.S. I've considered sparse checkout of submodules to solve the matter without changing my current makefile, but SourceTree does not support this yet, and I rely heavily on it for my use of git.

A: You are asking for a technological solution to a non-technological problem.
You have these constraints:


*

*All files with certain extensions below a directory are source code files that are part of the project.

*Except people randomly make additional files that violates the first constraint.

*Except some random additional files do not violate the first constraint.


Your options include:


*

*Teach people to use a naming convention for temporary files.

*Ignore the file system and compile the source code control system.

*Compile only what compiled last time and ask about new files.

*Make lots of different combinations of compilations and keep only the ones that compile.

*Figure out how to compile quickly enough that it doesn't matter.   (The Go language has this as a design constraint.)


There is really no way to completely have your cake and fully eat is as well.

A: A hybrid solution was indeed the final outcome.
My makefile now contains two separate variables:


*

*a list of directories which may be searched both exhaustively AND recursively for sources to compile - this is used for the main application code over which I have control and which also changes very often, thus I need not explicitly add/remove sources to/from the makefile whenever I add/remove to/from the application's source tree;

*a list of explicit, cherry-picked sources - this used for libraries over which I have no control and where I thus must pick individual sources in order to avoid compiling unwanted sources like tests and examples.


...By combining these two into a single list, I now have my full source list to pass to $CC, with greater control and only marginally less convenience.

user
I counted 121 "l"s in that text.
assistant