#******************************************************************************
|
# The Makefile of Compiling Rules
|
# Created ---------- xujian, 2012/5/2
|
#******************************************************************************
|
|
#*****************************************
|
# Compiling Rules
|
#*****************************************
|
export PUB_PATH := $(shell pwd)/..
|
export CROSS_COMPILE :=
|
export ASM := $(CROSS_COMPILE)asm
|
export AR := $(CROSS_COMPILE)ar
|
export CC := $(CROSS_COMPILE)gcc
|
export CXX := $(CROSS_COMPILE)g++
|
export LD := $(CROSS_COMPILE)ld
|
export STRIP := $(CROSS_COMPILE)strip -s -g
|
export RM := rm -fr
|
export CP := cp -f
|
export MKDIR := mkdir
|
|
export CXX_OPTS := -c -g -Wall -O0 -Wno-unused-but-set-variable -fpic
|
export LNK_OPTS := -lpthread -Wl,-Bdynamic -lgcc_s
|
|
#*****************************************
|
# Target Definations
|
#*****************************************
|
TARGET := librtspclient.so
|
TEST_MAIN := test_rtspclient.out
|
|
DIRS := $(PUB_PATH)/jrtplib-3.9.1 \
|
$(PUB_PATH)/jthread-1.3.1 \
|
$(PUB_PATH)/RtspLib
|
|
PUB_LIBS := $(PUB_PATH)/jrtplib-3.9.1/libjrtplib-3.9.1.a \
|
$(PUB_PATH)/jthread-1.3.1/libjthread-1.3.1.a \
|
$(PUB_PATH)/RtspLib/librtsplib.a
|
|
export COMMON_INC := -I$(PUB_PATH)/jrtplib-3.9.1 \
|
-I$(PUB_PATH)/jthread-1.3.1 \
|
-I$(PUB_PATH)/RtspLib
|
|
SPEC_OBJS := sps_pps.o MyThread.o TcpTransport.o RtspClient.o RtspClientSession.o TcpStreamTrans.o UdpStreamTrans.o RtpApp2.o RtpApp.o librtsp.o
|
MAIN_OBJS := sps_pps.o MyThread.o TcpTransport.o RtspClient.o RtspClientSession.o TcpStreamTrans.o UdpStreamTrans.o RtpApp2.o RtpApp.o librtsp.o test_main.o
|
|
#for stream parse
|
PUB_LIBSO += -L$(PUB_PATH)/RtspClientLib -lStreamParse
|
|
MAIN_LIBSO += -L$(PUB_PATH)/RtspClientLib -lStreamParse -L$(PUB_PATH)/RtspClientLib -lrtspclient
|
|
all: $(TARGET) $(TEST_MAIN)
|
|
# 2. 生成.o文件
|
%.o:%.cpp
|
@$(foreach dir, $(DIRS), $(MAKE) -C $(dir);)
|
@$(CXX) $(CXX_OPTS) $(CFLAGS) -fpic -c $< -o $@ $(COMMON_INC) $(PUB_LIBSO)
|
|
# 3. 生成动态库文件
|
$(TARGET):$(SPEC_OBJS)
|
g++ -shared -o $@ $(SPEC_OBJS) $(PUB_LIBS)
|
cp $(PUB_PATH)/RtspClientLib/librtspclient.so $(PUB_PATH)/Interface -rf
|
|
$(TEST_MAIN): $(MAIN_OBJS) $(PUB_LIBS)
|
$(CXX) $(MAIN_OBJS) $(PUB_LIBS) $(LNK_OPTS) $(MAIN_LIBSO) -o $(TEST_MAIN)
|
|
# 4. 删除中间过程生成的文件
|
.PHONY: clean
|
clean:
|
@$(foreach dir, $(DIRS), $(MAKE) -C $(dir) clean;)
|
@$(RM) *.o *.lib *.out librtspclient.so *.a
|
|
|
|
|
|
|