refactor the Makefile as a shell script and remove a little bit of cluttering