refactored build script for easier c&p between projects

Signed-off-by: Joern Bernhardt <jb@campudus.com>