#编译设置
export CXX:=g++
#调试export CXXFLAGS:=-g2 -O0
export CXXFLAGS:=-g0 -O2
#export LDFLAGS:=-static
#ACE目录
export CUR_DIR:=$(shell pwd)
export ACE_ROOT:=${CUR_DIR}/../ACE
#SPEEX目录
export SPEEXROOT:=${CUR_DIR}/../speex
#Codec目录
export CODECROOT:=${CUR_DIR}/Codec
#Packet目录
export PACKETROOT:=${CUR_DIR}/Packet
#公共库目录
export COMMONROOT:=${CUR_DIR}/CommonLib
#识别引擎目录
export SEARCHROOT:=${CUR_DIR}/SearchEngine
#反应器目录
export REACTORROOT:=${CUR_DIR}/Reactor
#静态库库目录
export LIBROOT:=${CUR_DIR}/lib
export RECVORROOT:=${CUR_DIR}/Recvor
export CONSOLEROOT:=${CUR_DIR}/Console
export CLIENTROOT:=${CUR_DIR}/SphClient
export HTTPROOT:=${CUR_DIR}/HttpClient
export DAEMONROOT:=${CUR_DIR}/JuliusDaemon
export WEBROOT:=${CUR_DIR}/Web
#二进制文件目录
INSTALLDIR:=${CUR_DIR}/bin
all:
cp ${ACE_ROOT}/lib/libACE.a lib/.
cp ${SPEEXROOT}/lib/libspeex.a lib/.
cd ${COMMONROOT}&&make
cd ${REACTORROOT}&&make
cd ${CODECROOT}&&make
cd ${PACKETROOT}&&make
cd ${SEARCHROOT}&&make
cd ${RECVORROOT}&&make
cd ${WEBROOT}&&make
install:
@if [ -d ${INSTALLDIR} ];\
then mv ${RECVORROOT}/Recvor ${INSTALLDIR}/Recvor &&\
mv ${RECVORROOT}/SphClient ${INSTALLDIR}/SphClient &&\
mv ${RECVORROOT}/HttpClient ${INSTALLDIR}/HttpClient &&\
mv ${RECVORROOT}/Console ${INSTALLDIR}/Console &&\
mv ${RECVORROOT}/JuliusDaemon ${INSTALLDIR}/JuliusDaemon &&\
mv ${WEBROOT}/Web ${INSTALLDIR}/Web;\
echo "Installed in ${INSTALLDIR}";\
else \
echo "${INSTALLDIR} does not exist";\
fi
.PHONY:clean
clean:
-rm -rf ${LIBROOT}/*.a
cd ${COMMONROOT}&&make clean
cd ${CODECROOT}&&make clean
cd ${PACKETROOT}&&make clean
cd ${REACTORROOT}&&make clean
cd ${SEARCHROOT}&&make clean
cd ${RECVORROOT}&&make clean
cd ${HTTPROOT}&&make clean
cd ${CLIENTROOT}&&make clean
cd ${DAEMONROOT}&&make clean
cd ${WEBROOT}&&make clean
整个工程的makefile
Web:Main.o HttpEventHandler.o HttpServer.o HttpSession.o HttpParse.o
g++ -ldl -g2 -O0 -lrt -lpthread -lcurl -o $@ $^ ${LIBROOT}/libReactor.a ${LIBROOT}/libSearchEngine.a ${LIBROOT}/libCodec.a ${LIBROOT}/libCommon.a ${LIBROOT}/libACE.a ${LIBROOT}/libspeex.a
%.o:%.cpp
g++ ${CXXFLAGS} -I${REACTORROOT} -I${COMMONROOT} -I${CODECROOT} -I${SPEEXROOT}/include -I${SEARCHROOT} -I${ACE_ROOT}/include -c $^ -o $@
.PHONY:clean
clean:
-rm *.o Web
DLL的makefile
#base fuction static library
libCommon.a:JuliusFake.o JuliusDaemon.o JuliusProxy.o UDPCom.o RecResult.o BufferParse.o DataMode.o ProcessWrapper.o SynMutex.o SynSpinLock.o Node.o SessionId.o XmlWrap.o XmlNode.o HttpRequest.o HttpResponse.o
${AR} ${ARFLAGS} $@ $^
mv libCommon.a ${LIBROOT}/libCommon.a
%.o:%.cpp
${CXX} -I${ACE_ROOT}/include ${CXXFLAGS} -c $^ -o $@
.PHONY:clean
clean:
-rm -rf *.o libCommon.a
#speech compress and decompress static library which depend on speex library
libCodec.a:Compressor.o Decompressor.o
${AR} ${ARFLAGS} $@ $^
mv libCodec.a ${LIBROOT}/libCodec.a
Codec:Main.o Compressor.o Decompressor.o
${CXX} -I${SPEEXROOT}/include -L${SPEEXROOT}/lib ${CXXFLAGS} -lspeex -o $@ $^
%.o:%.cpp
${CXX} -I${SPEEXROOT}/include ${CXXFLAGS} -c $^ -o $@
.PHONY:clean
clean:
-rm -rf *.o Codec libCodec.a
#APR头文件目录
APRROOT:=/usr/include/apr-1
#HTTP头文件目录
HTTPROOT:=/usr/include/httpd
#SPEEX压缩库头文件目录
SPEEXROOT:=/home/xiaoxing.zhou/speex
#COMMONLIB
COMMONROOT:=../CommonLib
ICONVROOT:=../Packet
HWRAPROOT:=../SearchEngine
#动态共享库安装目录
INSTALLROOT:=/etc/httpd/modules
#LDFLAGS:=-g
#CCFLAGS:=-g
#CXXFLAGS:=-g
install:mod_cloud_recog.so Main
mv mod_cloud_recog.so ${INSTALLROOT}/mod_cloud_recog.so
Main:Main.o
gcc -L./ -lpost_process -o $@ $^
mod_cloud_recog.so:mod_cloud_recog.o libpost_process.so
gcc ${CCFLAGS} -shared -L${SPEEXROOT}/lib -Wl,-rpath=./ -lspeex -lcurl -L./ -lpost_process -o $@ mod_cloud_recog.o
mod_cloud_recog.o:mod_cloud_recog.c
gcc ${CCFLAGS} -fpic -I${APRROOT} -I${HTTPROOT} -I${SPEEXROOT}/include -c $^
libpost_process.so:post_process.o RecResult.o BufferParse.o DataMode.o XmlNode.o XmlWrap.o CharFormatConvert.o CharTable.o HttpWrap.o
g++ ${CXXFLAGS} -shared -lcurl -o $@ $^
post_process.o:post_process.cpp
g++ ${CXXFLAGS} -fpic -I${COMMONROOT} -I${ICONVROOT} -I${HWRAPROOT} -c $^
RecResult.o:${COMMONROOT}/RecResult.cpp
g++ ${CXXFLAGS} -fpic -I${COMMONROOT} -c $^
BufferParse.o:${COMMONROOT}/BufferParse.cpp
g++ ${CXXFLAGS} -fpic -I${COMMONROOT} -c $^
DataMode.o:${COMMONROOT}/DataMode.cpp
g++ ${CXXFLAGS} -fpic -I${COMMONROOT} -c $^
XmlWrap.o:${COMMONROOT}/XmlWrap.cpp
g++ ${CXXFLAGS} -fpic -I${COMMONROOT} -c $^
XmlNode.o:${COMMONROOT}/XmlNode.cpp
g++ ${CXXFLAGS} -fpic -I${COMMONROOT} -c $^
CharFormatConvert.o:${ICONVROOT}/CharFormatConvert.cpp
g++ ${CXXFLAGS} -fpic -I${ICONVROOT} -c $^
CharTable.o:${ICONVROOT}/CharTable.cpp
g++ ${CXXFLAGS} -fpic -I${ICONVROOT} -c $^
HttpWrap.o:${HWRAPROOT}/HttpWrap.cpp
g++ ${CXXFLAGS} -fpic -I${ICONVROOT} -I${HWRAPROOT} -c $^
.PHONY:
clean:
-rm -rf *.o cloud_recog.so libpost_process.so
#network data process static library
libPacket.a:Packet.o PacketManager.o TransmitChannel.o Frame.o PacketParse.o PacketEncap.o
${AR} ${ARFLAGS} $@ $^
mv libPacket.a ${LIBROOT}/libPacket.a
%.o:%.cpp
${CXX} ${CXXFLAGS} -I${ACE_ROOT}/include -I${COMMONROOT} -c $^ -o $@
.PHONY:clean
clean:
-rm -rf *.o libPacket.a
#Reactor static library
libReactor.a:RecvorReactor.o RecvorReactorManager.o ProcessThread.o ThreadPool.o EpollReactor.o
${AR} ${ARFLAGS} $@ $^
mv libReactor.a ${LIBROOT}/libReactor.a
%.o:%.cpp
${CXX} ${CXXFLAGS} -I${ACE_ROOT}/include -I${COMMONROOT} -c $^ -o $@
.PHONY:clean
clean:
-rm -rf *.o libReactor.a
#recognition search engine wrapper class
libSearchEngine.a:Configuration.o MultiParam.o SearchPool.o SearchEngine.o SearchManager.o IBMEngine.o JuliusEngine.o TsingEngine.o Base64.o HttpWrap.o CharFormatConvert.o CharTable.o HttpClient.o
${AR} ${ARFLAGS} $@ $^
mv libSearchEngine.a ${LIBROOT}/libSearchEngine.a
SearchEngine:Main.o SearchEngine.o SearchManager.o SearchConfig.o IBMEngine.o JuliusEngine.o Base64.o HttpWrap.o ${LIBROOT}/libPacket.a
${CXX} -L./ -lPacket -L${ACE_ROOT}/lib -lACE -lrt -lcurl -pthread -o $@ $^
CharFormatConvert.o:${PACKETROOT}/CharFormatConvert.cpp
${CXX} ${CXXFLAGS} -I${PACKETROOT} -c $^ -o $@
CharTable.o:${PACKETROOT}/CharTable.cpp
${CXX} ${CXXFLAGS} -I${PACKETROOT} -c $^ -o $@
%.o:%.cpp
${CXX} ${CXXFLAGS} -I${COMMONROOT} -I${ACE_ROOT}/include -I${PACKETROOT} -c $^ -o $@
.PHONY:clean
clean:
-rm -rf *.o libSearchEngine.a SearchEngine