求大神讲解下面这个Makefile的意思;希望能够详细一些;谢谢;
LIBC_VER=$(shellls/lib/libc-*.so|cut-c11-13)CPP_FILE=*.cppINC_FILE=-I./TAR_FILE=./Gam...
LIBC_VER = $(shell ls /lib/libc-*.so | cut -c11-13)
CPP_FILE = *.cpp
INC_FILE = -I./
TAR_FILE = ./GameProxy
INC_TOOL = -I/home/user/install/libevent/include
LNK_TOOL = -L/home/user/install/libevent/lib /usr/lib64/libevent.a -ldl -rdynamic -lrt
LNK_TOOL +=
INC_MYSQL =
LNK_MYSQL =
INC = $(INC_TOOL) $(INC_MYSQL) $(INC_FILE)
LNK = $(LNK_TOOL) $(LNK_MYSQL)
CPP = $(wildcard *.cpp)
OBJ = $(CPP:%.cpp=%.o)
all:$(TAR_FILE)
$(TAR_FILE): $(OBJ)
@g++ -g -o $@ $^ $(INC) $(LNK)
@echo $@
%.o: %.cpp
@g++ -W -Wall -Wshadow -fPIC -g -c $*.cpp $(INC)
@echo $@
clean:
rm -f *.o
rm $(TAR_FILE) 展开
CPP_FILE = *.cpp
INC_FILE = -I./
TAR_FILE = ./GameProxy
INC_TOOL = -I/home/user/install/libevent/include
LNK_TOOL = -L/home/user/install/libevent/lib /usr/lib64/libevent.a -ldl -rdynamic -lrt
LNK_TOOL +=
INC_MYSQL =
LNK_MYSQL =
INC = $(INC_TOOL) $(INC_MYSQL) $(INC_FILE)
LNK = $(LNK_TOOL) $(LNK_MYSQL)
CPP = $(wildcard *.cpp)
OBJ = $(CPP:%.cpp=%.o)
all:$(TAR_FILE)
$(TAR_FILE): $(OBJ)
@g++ -g -o $@ $^ $(INC) $(LNK)
@echo $@
%.o: %.cpp
@g++ -W -Wall -Wshadow -fPIC -g -c $*.cpp $(INC)
@echo $@
clean:
rm -f *.o
rm $(TAR_FILE) 展开
展开全部
LIBC_VER = $(shell ls /lib/libc-*.so | cut -c11-13) 显示gcc版本号
CPP_FILE = *.cpp cpp文件扩展名
INC_FILE = -I./ include 路径
TAR_FILE = ./GameProxy 编译目标
INC_TOOL = -I/home/user/install/libevent/include include路径
LNK_TOOL = -L/home/user/install/libevent/lib /usr/lib64/libevent.a -ldl -rdynamic -lrt 链接库路径
LNK_TOOL +=
INC_MYSQL =
LNK_MYSQL =
INC = $(INC_TOOL) $(INC_MYSQL) $(INC_FILE) include路径
LNK = $(LNK_TOOL) $(LNK_MYSQL) 连接库路径
CPP = $(wildcard *.cpp) 源文件为当前文件夹下所有cpp文件
OBJ = $(CPP:%.cpp=%.o) 目标文件为当前文件夹下所有cpp文件每个都生成一个o文件
all:$(TAR_FILE)
$(TAR_FILE): $(OBJ) 生成编译目标
@g++ -g -o $@ $^ $(INC) $(LNK)
@echo $@
%.o: %.cpp 生成.o文件
@g++ -W -Wall -Wshadow -fPIC -g -c $*.cpp $(INC)
@echo $@
clean: 清除文件
rm -f *.o
rm $(TAR_FILE)
CPP_FILE = *.cpp cpp文件扩展名
INC_FILE = -I./ include 路径
TAR_FILE = ./GameProxy 编译目标
INC_TOOL = -I/home/user/install/libevent/include include路径
LNK_TOOL = -L/home/user/install/libevent/lib /usr/lib64/libevent.a -ldl -rdynamic -lrt 链接库路径
LNK_TOOL +=
INC_MYSQL =
LNK_MYSQL =
INC = $(INC_TOOL) $(INC_MYSQL) $(INC_FILE) include路径
LNK = $(LNK_TOOL) $(LNK_MYSQL) 连接库路径
CPP = $(wildcard *.cpp) 源文件为当前文件夹下所有cpp文件
OBJ = $(CPP:%.cpp=%.o) 目标文件为当前文件夹下所有cpp文件每个都生成一个o文件
all:$(TAR_FILE)
$(TAR_FILE): $(OBJ) 生成编译目标
@g++ -g -o $@ $^ $(INC) $(LNK)
@echo $@
%.o: %.cpp 生成.o文件
@g++ -W -Wall -Wshadow -fPIC -g -c $*.cpp $(INC)
@echo $@
clean: 清除文件
rm -f *.o
rm $(TAR_FILE)
追问
求加QQ;谢谢。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询