Add makefile and split the functions into separate files.