how to make a simple make file in c++

First hit on google: makefile tutorial. Do you have any specific question?

Remember that makefiles are space-tab sensitive (a very annoying aspect of makefile syntax), meaning that the number of spaces and tabs (and where tabs appear rather than spaces) is important.

Frankly, writing makefiles directly by hand is out-right torture. Most people use something else to generate the makefiles (and that's what most IDEs do under-the-hood too). I recommend something like CMake which is just as light-weight as make, but has a much simpler and more intuitive syntax. It is good to be familiar with makefile syntax mostly as a skill for being able to diagnose problems (read makefiles) and do some quick fixes in the makefiles, but actually writing a makefile from scratch is rather unusual, even the more masochistic people use a tool like autoconf (which is only marginally better than makefiles).