一个相对比较模式化的模板,g++用的。
参考资料:
http://www.metalshell.com/view/tutorial/120/
#Compiler and flags
CC = g++
LD = g++
CXXFLAGS := -O3 -I /usr/include -I ../include_deps/ -I../include_deps/thrift
LINKFLAGS := ../lib_deps/libthrift.a
#Objects
OBJS := $(patsubst %.cpp, %.o, $(wildcard *.cpp)) \
$(patsubst %.cpp, %.o, $(wildcard ./path2/*.cpp))
#Generate binary name
PROGS = TestCassandraAPI
all: $(PROGS)
$(PROGS): $(OBJS)
$(LD) $(OBJS) $(LINKFLAGS) -o $(PROGS)
%.o:%.cpp
$(CC) $(CXXFLAGS) -c -o $@ $<
.PHONY: all clean
clean:
rm -rf $(OBJS) $(OJBS:.o=.d) $(PROGS)