自己写onvif视频模拟器时写的Makefile


MODENAME	= INFRTPServer
CC		= gcc
CXX		= g++
OUTPUT		= ./
OBJ_MAIN	= ../

BIN_PATH	= $(OBJ_MAIN)bin/
LIB_PATH	= $(OUTPUT)lib/
OBJDIR		= $(OBJ_MAIN)obj/
PROGRAM		= $(BIN_PATH)$(MODENAME)
PREFIX		= ./

MYREVISION	= 0
MYMAJORVERSION	= 0
RELEASE		= 0
IsX64		= 1
MYVERSION	= "\"${MYMAJORVERSION}.${MYREVISION}\""

SRC_ROOT        =../INFRTPServer
OnvifPath   = ../../../../DeviceSdk/GSoap2.8.34_Onvif_2.6/

INCLUDES	+= -I./
INCLUDES	+= -I../../../../thirdparty/live555_linux/live/include/BasicUsageEnvironment
INCLUDES	+= -I../../../../thirdparty/live555_linux/live/include/groupsock
INCLUDES	+= -I../../../../thirdparty/live555_linux/live/include/liveMedia
INCLUDES	+= -I../../../../thirdparty/live555_linux/live/include/UsageEnvironment
INCLUDES	+= -I../../../../thirdparty/jrtplib/src
INCLUDES	+= -I../../../../protocol/InfiVmsMedia/common
INCLUDES     += -I../../../../include 
INCLUDES 	+= -I../../../../include/boost 
INCLUDES	+= -I../../../../common/
INCLUDES	+= -I../../../../common/asyn 
INCLUDES	+= -I../../../../common/memory 
INCLUDES	+= -I../../../../thirdparty/json/include 
INCLUDES	+= -I../../../../thirdparty/ilog   
INCLUDES	+= -I../../../../thirdparty/rapidxml/
INCLUDES	+= -I../../../../thirdparty/ffmpeg_linux/include
INCLUDES    += -I../../../../thirdparty/openssl-1.0.2l-linux/include
INCLUDES    += -I../../../../thirdparty/openssl-1.0.2l-linux/include/openssl
INCLUDES    += -I$(OnvifPath)

SRC		+= $(wildcard ./*.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/BoostAsioSocket.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/BoostAsioTest.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/BoostIoServicePool.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/GlobalParam.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/HandleManager.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/RtspSerializer.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/SdpSerializer.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/ServiceListener.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/StreamParserBase.cpp)
SRC     += $(wildcard ../../../../protocol/InfiVmsMedia/common/TaskHelper.cpp)

SRC		+= $(wildcard ../../../../common/asyn/Asyn_Thread.cpp)
SRC		+= $(wildcard ../../../../common/asyn/RefWorker.cpp)
SRC		+= $(wildcard ../../../../common/asyn/Semaphore.cpp)
SRC		+= $(wildcard ../../../../common/asyn/Task.cpp)
SRC		+= $(wildcard ../../../../common/asyn/TaskProxy.cpp)
SRC		+= $(wildcard ../../../../common/asyn/TaskQueue.cpp)
SRC		+= $(wildcard ../../../../common/asyn/TaskStrand.cpp)
SRC		+= $(wildcard ../../../../common/asyn/ThreadPool.cpp)
SRC		+= $(wildcard ../../../../common/asyn/ThreadWorker.cpp)
#SRC		+= $(wildcard ../../../../common/asyn/Timer.cpp)
SRC		+= $(wildcard ../../../../common/asyn/WorkerGroup.cpp)
SRC		+= $(wildcard ../../../../common/asyn/WorkEvent.cpp)

SRC		+= $(wildcard ../../../../common/memory/*.cpp)

#Gsoap
SRC     += $(wildcard $(OnvifPath)dom.cpp)
SRC     += $(wildcard $(OnvifPath)duration.cpp)
SRC     += $(wildcard $(OnvifPath)md5evp.cpp)
SRC     += $(wildcard $(OnvifPath)mecevp.cpp)
SRC     += $(wildcard $(OnvifPath)namespace.cpp)
SRC     += $(wildcard $(OnvifPath)smdevp.cpp)
SRC     += $(wildcard $(OnvifPath)soapC.cpp)
SRC     += $(wildcard $(OnvifPath)soapServer.cpp)
SRC     += $(wildcard $(OnvifPath)stdsoap2.cpp)
SRC     += $(wildcard $(OnvifPath)threads.cpp)
SRC     += $(wildcard $(OnvifPath)wsaapi.cpp)
SRC     += $(wildcard $(OnvifPath)wsseapi.cpp)

OBJECTS	 = $(SRC:%.cpp=%.o)

ifeq ($(IsX64), 0)
#i386

else
#x86_64
LDFLAGS		+= -L../../../../thirdparty/ffmpeg_linux/lib/
LDFLAGS		+= -L../../../../lib/x64
LDFLAGS		+= -L../../../../lib/boost/x64/
LDFLAGS     += -L../../../../thirdparty/jrtplib/build/src/
#LDFLAGS    += -L../../../../thirdparty/openssl-1.0.2l-linux

#LIBS       += -lcrypto -lssl
LIBS        +=../../../../thirdparty/openssl-1.0.2l-linux/libssl.a
LIBS        +=../../../../thirdparty/openssl-1.0.2l-linux/libcrypto.a

LIBS        +=  -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswscale -lswresample -ljrtp -Wl,--rpath=./ -lilog -lpi -llog4cxx   
LIBS		+= -lboost_system -lboost_timer -lboost_thread-mt -lboost_regex -lboost_date_time -lboost_chrono -lboost_system-mt -lpthread -luuid -ldl
CFLAGS		+= -m64
endif

all:third $(PROGRAM)

ifeq ($(RELEASE),1)
#Release Version
CFLAGS		+= -std=c++11 -o2 -Wall -Wunused -fPIC -g -fpermissive $(INCLUDES) -DTIXML_USE_STL -DVERSION__=$(MYVERSION)
#CFLAGS          += -D__GOOGLE_BREAKPAD_MINIDUMP__
else
#Debug Version
CFLAGS		+= -std=c++11 -Wall -Wunused -fPIC -g -fpermissive -gdwarf-2 $(INCLUDES) -DTIXML_USE_STL -DVERSION__=$(MYVERSION) -D_DEBUG -DWITH_DOM -DWITH_OPENSSL
#CFLAGS		+= -D__GOOGLE_BREAKPAD_MINIDUMP__
endif


$(PROGRAM): $(BIN_PATH) $(LIB_PATH) $(OBJDIR) $(OBJECTS) 
	$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJECTS)  -o  $(PROGRAM)  $(LIBS)

$(BIN_PATH):
	mkdir -p $(BIN_PATH)
$(LIB_PATH):
	mkdir -p $(LIB_PATH)
$(OBJDIR):
	mkdir -p $(OBJDIR)

$(OBJECTS): %.o : %.cpp
	$(CXX) $(CFLAGS) -c $< -o $@ $(INCLUDES)
$(OBJECTS_C): %.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@ $(INCLUDES)

third:
	@echo "======================= building jrtp"
	@make -C ../../../../thirdparty/jrtplib
	@make -C ../../../../thirdparty/json/build
	@cp -f ../../../../thirdparty/jrtplib/build/src/libjrtp.so.*   ../lib-x64/linux-64
	
.PHONY:clean
clean:
	-rm -rf $(OBJECTS)

你可能感兴趣的:(Linux应用编程)