You are missing fi at the end, but you could also write a GNU Makefile like this:
CXX=g++
CXXFLAGS=-Wall
OBJS=main.o
EXECUTABLE=main
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o $@
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJS)
main.o: main.cpp
Note, this is a flexible example, and you could simplify this even further down the line. Here you can find a very good tutorial to read upon:
http://mrbook.org/tutorials/make/
However, I would strongly suggest to learn cmake instead as writing Makefiles manually are painful.
A CMakeLists.txt file could be something like this:
add_executable(main main.cpp)
then simply:
mkdir -p build && cd build && cmake ../ && make VERBOSE=1
and then you would be done in a cross platform way as GNU Makefiles only work on Unices. You would need to adjust that for Windows and so forth to get it work. cmake is freely available pretty much everywhere needed, and it has proper support for native builds, cross compilation.
This forum also has a cmake tag with several people around to help you.