Minor fixes and improvements in makefiles
Merge commit '9eb001222e6a70459e9b1c5fc166769705f80887'