Thank you, Lars.
The links you have provided have managed to make things clearer to me now.
I understand how a flag in the makefile can be changed by passing a parameter to the make command in the command line and how
"origin" checks where the variable comes from.
I did realize creating the dependency of the Makefile itself would indeed not be a good idea at the finer level of granularity.
I went through the documentation at
http://unikraft.neclab.eu/developers-app.html and can now understand the structure of makefiles of libraries better.
I spent some time studying the problem and came across this solution at
https://www.cmcrossroads.com/article/rebuilding-when-cppflags-changes which uses the concept of signatures.
I also understood how rules are dynamically being set by the Makefiles in support/build/ directory.
To be able to draft a solution there's one more thing lacking my understanding, which is the order of the execution of the makefiles.
What calls the dynamic makefiles and when is the main makefile called and how do the dynamic makefiles pass those parameters to the main one?