首页 > 代码库 > makefile模板(生成.so)

makefile模板(生成.so)

# Make command to use for dependenciesRM=rmMKDIR=mkdirOUTDIR=_objSODIR=./binLIBNAME=pdk_ai.soOUTFILE=$(SODIR)/$(LIBNAME)INC=-I../../../../lib/svrlib/include -I../../../../lib/tinyxml -I../../../include LIB=-lpthread -lrt -ldl #obj dirTINYXML=../../../../lib/tinyxmlEXEFILE=$(EXEDIR)/$(APP)SRC := $(wildcard *.cpp $(TINYXML)/*.cpp)OBJ := $(patsubst %.cpp, $(OUTDIR)/%.o, $(notdir ${SRC}))		COMPILE=g++ -c -o "$(OUTDIR)/$(*F).o" $(INC) -fPIC -w "$<"LINK=g++ -o "$(OUTFILE)" $(OBJ) $(LIB) -shared -fPIC# Pattern rules$(OUTDIR)/%.o : $(TINYXML)/%.cpp	$(COMPILE)$(OUTDIR)/%.o : ./%.cpp	$(COMPILE)	# Build rulesall: $(OUTFILE)$(OUTFILE): $(OUTDIR)  $(OBJ)	$(LINK)#	sh sh_ver.sh ./win/svrlib.rc $(OUTFILE)   #update ver. ( read by "readelf -h libsvr.so")#	sh sh_tar.sh  ./win/*.rc  $(SODIR)  $(LIBNAME) #tar file$(OUTDIR):	$(MKDIR) -p "$(OUTDIR)"	$(MKDIR) -p "$(SODIR)"	# Rebuild this projectrebuild: cleanall all# Clean this projectclean:	$(RM) -f $(OUTFILE)	$(RM) -f $(OBJ)# Clean this project and all dependenciescleanall: clean

 

makefile模板(生成.so)