zl程序教程

您现在的位置是:首页 >  其它

当前栏目

一个比较通用的makefile

一个 比较 通用 Makefile
2023-09-14 09:07:02 时间
CXX = g++
LIB = -L/data/protobuf/2.5.0_x64/lib/
INC = -I/data/protobuf/2.5.0_x64/include/ -I./
CXXFLAGS = -DSNACC_DEEP_COPY -DHAVE_VARIABLE_SIZED_AUTOMATIC_ARRAYS -Wno-deprecated  -fPIC
 
TARGET=main
 
SRC=$(wildcard ./*.cpp)
 
OBJ=$(patsubst %.cpp, %.o, $(SRC))
 
$(TARGET): $(OBJ)
	$(CXX) $(CXXFLAGS) -o $@ $^ $(LIB) -lprotobuf
 
$(OBJ):%.o: %.cpp
	$(CXX) $(CXXFLAGS)  $(INC) -o $@ -c $<
 
clean:
	rm -f *.o
	rm -f $(TARGET)