当前位置: 技术问答>linux和unix
急!高分求救关于makefile的问题:
来源: 互联网 发布时间:2015-06-09
本文导语: 下面是一个完整工程的makefile文件,我没有看明白,急着用它,谁能帮我看一下: OUTLIB = libRTI.so.1.0.0 SONAME = libRTI.so.1 LINKLIB = libRTI.so CXX = g++ CXXFLAGS = -Wall -O2 -D_REENTRANT COMPILE = $(CXX) $(CXXFLAGS) # # ...
下面是一个完整工程的makefile文件,我没有看明白,急着用它,谁能帮我看一下:
OUTLIB = libRTI.so.1.0.0
SONAME = libRTI.so.1
LINKLIB = libRTI.so
CXX = g++
CXXFLAGS = -Wall -O2 -D_REENTRANT
COMPILE = $(CXX) $(CXXFLAGS)
#
# libRTI Makefile
#
OUTLIB = libRTI.so.1.0.0
SONAME = libRTI.so.1
LINKLIB = libRTI.so
CXX = g++
CXXFLAGS = -Wall -O2 -D_REENTRANT
COMPILE = $(CXX) $(CXXFLAGS)
#
# Included Files Path
#
INC_ASTDATA = -I./inc/AST_DATA
INC_VNET = -I./inc/VNet
INC_RTI = -I./inc/RTI
INC_BSTRUCT = -I./inc/BASE_STRUCT
INC_MAIN = $(INC_ASTDATA) $(INC_BSTRUCT) $(INC_VNET) $(INC_RTI)
#
# Files List
#
SRCS := $(wildcard ./src/AST_DATA/*.cpp) $(wildcard ./src/BASE_STRUCT/*.cpp) $(wildcard ./src/VNet/*.cpp) $(wildcard ./src/RTI/*.cpp)
OBJS := $(patsubst %.cpp,%.o, $(SRCS))
DEPS := $(patsubst %.o,%.d, $(OBJS))
#
# Output file
#
all: $(OUTLIB)
$(OUTLIB) : $(DEPS) $(OBJS)
$(COMPILE) -shared -lpthread -o $@ $(OBJS)
ln -sf $@ $(LINKLIB)
ln -sf $@ $(SONAME)
#
# specify that all .o files depend on .cpp files, and indicate how to realize it
#
%.d : %.cpp
$(CXX) $(INC_MAIN) -MM $ $@
$(CXX) $(INC_MAIN) -MM $> $@
#
# specify that all .o files depend on .cpp files, and indicate how to realize it
#
%.o : %.cpp
$(COMPILE) -fPIC -c $(INC_MAIN) -o $@ $
OUTLIB = libRTI.so.1.0.0
SONAME = libRTI.so.1
LINKLIB = libRTI.so
CXX = g++
CXXFLAGS = -Wall -O2 -D_REENTRANT
COMPILE = $(CXX) $(CXXFLAGS)
#
# libRTI Makefile
#
OUTLIB = libRTI.so.1.0.0
SONAME = libRTI.so.1
LINKLIB = libRTI.so
CXX = g++
CXXFLAGS = -Wall -O2 -D_REENTRANT
COMPILE = $(CXX) $(CXXFLAGS)
#
# Included Files Path
#
INC_ASTDATA = -I./inc/AST_DATA
INC_VNET = -I./inc/VNet
INC_RTI = -I./inc/RTI
INC_BSTRUCT = -I./inc/BASE_STRUCT
INC_MAIN = $(INC_ASTDATA) $(INC_BSTRUCT) $(INC_VNET) $(INC_RTI)
#
# Files List
#
SRCS := $(wildcard ./src/AST_DATA/*.cpp) $(wildcard ./src/BASE_STRUCT/*.cpp) $(wildcard ./src/VNet/*.cpp) $(wildcard ./src/RTI/*.cpp)
OBJS := $(patsubst %.cpp,%.o, $(SRCS))
DEPS := $(patsubst %.o,%.d, $(OBJS))
#
# Output file
#
all: $(OUTLIB)
$(OUTLIB) : $(DEPS) $(OBJS)
$(COMPILE) -shared -lpthread -o $@ $(OBJS)
ln -sf $@ $(LINKLIB)
ln -sf $@ $(SONAME)
#
# specify that all .o files depend on .cpp files, and indicate how to realize it
#
%.d : %.cpp
$(CXX) $(INC_MAIN) -MM $ $@
$(CXX) $(INC_MAIN) -MM $> $@
#
# specify that all .o files depend on .cpp files, and indicate how to realize it
#
%.o : %.cpp
$(COMPILE) -fPIC -c $(INC_MAIN) -o $@ $