Add a building script and Makefile for building stand-alone version

This work needs more discussion and refactor.