A question regarding "sentinels" in included make files.
I've inherited a project with a hierarchy of gmake projects, which uses make recursively. Due to the structure of the project, some files are included multiple times (once for each use of recursive gmake). These files are nothing fancy. Just variable definitions with some very basic if-logic. No recipes or dependencies. No nested includes.
The multiple-inclusion creates maintenance headaches. E.g. One can't use += in these files. I'd like to block multiple inclusions.
Putting a sentinel in the included files is the obvious solution, e.g.
ifeq ($(FOO_INCLUDED),)
FOO_INCLUDED=yes
else
# everything else
endif
But .... adding such a sentinel makes some recipes disappear in some sub-projects. E.g. a "build" target might disappear, while the "clean" target for the same sub-project doesn't. Make reports no egregious errors - it does attempt to run things. It just reports a missing target.
So the question is ... what could cause recipes being lost?
Restructuring to avoid the multiple includes is unfortunately not an option. Each sub-project is supposed to be buildable from either it's own folder (cd sub-project ; gmake build), or from the root folder (cd proj-root ; gmake subproject_build)