fixed makefiles and building system