convert build script to a Makefile