rename make_hosts and make it suitable to be used within the build system

Change-Id: I206e0f0ecff94ffe09f94b60052983cac8a447a4