1 INCLUDEPATH=-I/usr/include/c++/4.8.4\ 2 -I./ 3 SOURCEDIR=./ 4 LIBRARYPATH:= 5 LIBRARY:= 6 SRCS=$(foreach dir,$(SOURCEDIR), $(wildcard $(dir)/*.cpp)) 7 TEMPOUTPUT:=$(foreach dir,$(SOURCEDIR), $(wildcard $(dir)/*.o)) 8 OBJECTS:=$(patsubst %.cpp,%.o,$(SRCS)) 9 TARGETS:=$(notdir $(PWD))10 11 .SUFFIXES:.o .cpp12 %.o:%.cpp13 $(CXX) $(INCLUDEPATH) -g -c -o $@ $< $(LIBRARYPATH) $(LIBRARY)14 15 all:$(TARGETS)16 17 $(TARGETS):$(OBJECTS)18 $(CXX) $(INCLUDEPATH) -g -o $@ $^ $(LIBRARYPATH) $(LIBRARY)19 20 run:21 ./$(TARGETS)22 23 clean:24 rm -rf $(TARGETS)25 rm -rf $(TEMPOUTPUT)