UBT configuration questions

How does UBT look for it’s targets and how it figures out build configuration for targets? E.g. what is the mechanism behind UBT when it links against static libs on shipping configuration and shared libs on development?
Where those magic files are located?

P.S.
I’ve tried to find them on myself, as I’ve got it, they are picked up by UBT on execution and they are soaked up (somehow) from everywhere in the ./Source directory. But still have no idea how one can get compiler and linker flags
for the given target.

Thanks.