一直看别人写的博客,自己动气手来,参考别人的文章写了个Makefile模板,结果用了一个多小时,果然是动手能力太差了以后要多写。
- CC = gcc
- CXX = g++
- INC_PATH = -I
- CXXFLAGS = -pg -g -Wall $(INC_PATH)
- RM = rm -rf
- SVR_SRC = $(wildcard *.cpp)
- SVR_OBJ = $(addprefix ./,$(subst .cpp,.o,$(SVR_SRC)))
- AR = ar -curs
- TARGET = test
- LDFLAGS =
- .PHONY: all clean
- all : $(TARGET)
- $(TARGET) : $(SVR_OBJ)
- $(CXX) -o $@ $(SVR_OBJ) $(CPPFLAGS) $(LDFLAGS)
-
- %.o : %.cpp
- $(CXX) -o $@ -c $< $(CPPFLAGS)
-
- clean:
- $(RM) $(SVR_OBJ) $(TARGET)
阅读(420) | 评论(0) | 转发(0) |