New smarter makefile, fix for #47