######### 标准Makefile Lv1.0 ######## EXE=helloworld SUBDIR=src object #CXX_SOURCES=$(wildcard *.cpp) CXX_SOURCES =$(foreach dir,$(SUBDIR), $(wildcard $(dir)/*.cpp)) CXX_OBJECTS=$(patsubst %.cpp, %.o, $(CXX_SOURCES)) DEP_FILES =$(patsubst %.o, %.d, $(CXX_OBJECTS)) $(EXE): $(CXX_OBJECTS) g++ $(CXX_OBJECTS) -o $(EXE) %.o: %.cpp g++ -c -MMD $< -o $@ -include $(DEP_FILES) clean: rm -rf $(CXX_OBJECTS) $(DEP_FILES) $(EXE) test: echo $(CXX_OBJECTS)