-
Notifications
You must be signed in to change notification settings - Fork 62
/
Makefile
90 lines (70 loc) · 3.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
SYSROOT?=$(shell $(CXX) --print-sysroot)
PREFIX?=/usr
DESTDIR?=$(PREFIX)/bin
$(info PREFIX=$(PREFIX) SYSROOT=$(SYSROOT) DESTDIR=$(DESTDIR))
VERSION=$(shell git describe --tags --always --dirty)
$(info VERSION=$(VERSION))
GSOAP_PREFIX?=$(SYSROOT)/usr
GSOAP_BIN?=$(GSOAP_PREFIX)/bin
GSOAP_BASE=$(GSOAP_PREFIX)/share/gsoap
GSOAP_PLUGINS=$(GSOAP_BASE)/plugin
CMAKE_CXX_FLAGS:=$(CXXFLAGS)
CXXFLAGS+=-std=c++11 -g2 -I inc -I ws-discovery/gsoap/
CXXFLAGS+=-I gen -I $(GSOAP_PREFIX)/include -I $(GSOAP_PLUGINS)
CXXFLAGS+=-DWITH_DOM -DWITH_OPENSSL -DSOAP_PURE_VIRTUAL -fpermissive -pthread -DVERSION=\"$(VERSION)\"
LDFLAGS+=-L $(GSOAP_PREFIX)/lib/ -lgsoapssl++ -lz -pthread -lssl -lcrypto -ldl -static-libstdc++
WSSE_SRC=$(GSOAP_PLUGINS)/wsseapi.c $(GSOAP_PLUGINS)/smdevp.c $(GSOAP_PLUGINS)/mecevp.c $(GSOAP_BASE)/custom/struct_timeval.c
WSSE_OBJ=$(WSSE_SRC:%.c=%.o)
SOAP_SRC=$(wildcard gen/soapC_*.cpp)
SOAP_OBJ=$(SOAP_SRC:%.cpp=%.o)
SERVER_OBJ=gen/soapDeviceBindingService.o gen/soapDeviceIOBindingService.o
SERVER_OBJ+=gen/soapMediaBindingService.o gen/soapImagingBindingService.o
SERVER_OBJ+=gen/soapPTZBindingService.o
SERVER_OBJ+=gen/soapEventBindingService.o gen/soapPullPointSubscriptionBindingService.o gen/soapNotificationProducerBindingService.o gen/soapSubscriptionManagerBindingService.o
SERVER_OBJ+=gen/soapRecordingBindingService.o gen/soapReplayBindingService.o gen/soapSearchBindingService.o gen/soapReceiverBindingService.o
SERVER_OBJ+=gen/soapDisplayBindingService.o
CLIENT_OBJ=gen/soapDeviceBindingProxy.o gen/soapDeviceIOBindingProxy.o
CLIENT_OBJ+=gen/soapMediaBindingProxy.o gen/soapImagingBindingProxy.o
CLIENT_OBJ+=gen/soapPTZBindingProxy.o
CLIENT_OBJ+=gen/soapEventBindingProxy.o gen/soapPullPointSubscriptionBindingProxy.o gen/soapNotificationProducerBindingProxy.o gen/soapSubscriptionManagerBindingProxy.o
CLIENT_OBJ+=gen/soapRecordingBindingProxy.o gen/soapReplayBindingProxy.o gen/soapReceiverBindingProxy.o gen/soapSearchBindingProxy.o
CLIENT_OBJ+=gen/soapDisplayBindingProxy.o
all: gen/onvif.h libwsdd.a liblibv4l2rtspserver.a onvif-server.exe onvif-client.exe
gen/onvif.h: $(wildcard wsdl/*)
mkdir -p gen
$(GSOAP_BIN)/wsdl2h -d -Ntev -W -L -o $@ $^
$(GSOAP_BIN)/soapcpp2 -2jx $@ -I $(GSOAP_BASE)/import -I $(GSOAP_BASE) -I inc -d gen -f1000 -w || :
make
libserver.a: $(SERVER_OBJ) $(SOAP_OBJ) | gen/onvif.h
$(AR) rcs $@ $^
libclient.a: $(CLIENT_OBJ) $(SOAP_OBJ) | gen/onvif.h
$(AR) rcs $@ $^
ONVIF_SRC=$(wildcard src/server*.cpp)
libonvif.a: $(ONVIF_SRC:%.cpp=%.o)
$(AR) rcs $@ $^
# ws-discovery
libwsdd.a:
git submodule init ws-discovery
git submodule update ws-discovery
make -C ws-discovery/gsoap libwsdd.a
cp ws-discovery/gsoap/libwsdd.a .
# v4l2rtsp
liblibv4l2rtspserver.a:
git submodule update --recursive --init v4l2rtspserver
cd v4l2rtspserver && cmake -DALSA=OFF -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_FLAGS=$(CMAKE_CXX_FLAGS) . && make libv4l2rtspserver
cp v4l2rtspserver/$@ .
LIVE = v4l2rtspserver/live
CXXFLAGS += -I ${LIVE}/groupsock/include -I ${LIVE}/liveMedia/include -I ${LIVE}/UsageEnvironment/include -I ${LIVE}/BasicUsageEnvironment/include
CXXFLAGS += -I v4l2rtspserver/inc -I v4l2rtspserver/libv4l2cpp/inc
onvif-server.exe: src/onvif-server.o src/onvif_impl.o $(WSSE_SRC) libserver.a libonvif.a gen/soapNotificationConsumerBindingProxy.o libwsdd.a liblibv4l2rtspserver.a v4l2rtspserver/libv4l2cpp/liblibv4l2cpp.a
$(CXX) -g -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
onvif-client.exe: src/onvif-client.o $(WSSE_SRC) $(GSOAP_PLUGINS)/wsaapi.c libclient.a gen/soapNotificationConsumerBindingService.o libonvif.a
$(CXX) -g -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
clean:
make -C v4l2rtspserver clean || :
make -C ws-discovery/gsoap clean || :
rm -rf gen src/*.o *.a *.exe
install:
mkdir -p $(DESTDIR)
install -D -m 0755 onvif-server.exe $(DESTDIR)
install -D -m 0755 onvif-client.exe $(DESTDIR)