Generating main makefile, need few fixes and refactor