# A simple C++ Makefile see 'man make' # These are special C++ makefile variables. CXX is the C++ compiler to use and # CPPFLAGS are optional flags to give the compiler. CXX = g++ CPPFLAGS = # These are specific variables for the program that we are "making" OBJECTS = point.o TARGET = main # This is a typical target. The The syntax is: # target: dependancy list # command to make 'target' $(TARGET): $(OBJECTS) $(TARGET).o $(CXX) $(CPPFLAGS) -o $@ $(OBJECTS) $@.o # this is the old style for implicit rules. This is used here because # the new style does not work with all 'make' programs. This basically # tells the compiler how to make any .o file from any .cpp file. .cpp.o: $(CXX) $(CPPFLAGS) -c -o $@ $< .SUFFIXES: .cpp # this is a dummy rule which is just a convenience to have. # type 'make clean' and you will remove all .o and executables # so you can compile again from scratch. clean: rm -f $(TARGET) $(TARGET).o $(OBJECTS)