-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
197 lines (148 loc) · 5.23 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#
# Makefile for the RoboTV plugin
#
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
#
PLUGIN = robotv
### Should the mDNS/DNS-SD part be enabled
AVAHI_CFLAGS := $(shell pkg-config --silence-errors --cflags avahi-client)
AVAHI_LIBS := $(shell pkg-config --silence-errors --libs avahi-client)
AVAHI_ENABLED := $(shell pkg-config --exists avahi-client && echo 1)
### The version number of this plugin:
VERSION = 0.15.0
### The directory environment:
# Use package data if installed...otherwise assume we're under the VDR source directory:
PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr 2>/dev/null || pkg-config --variable=$(1) ../../../vdr.pc 2>/dev/null))
LIBDIR = $(call PKGCFG,libdir)
LOCDIR = $(call PKGCFG,locdir)
PLGCFG = $(call PKGCFG,plgcfg)
CFGDIR = $(call PKGCFG,configdir)/plugins/$(PLUGIN)
#
TMPDIR ?= /tmp
### The SQLITE compile options:
export SQLITE_CFLAGS = -DHAVE_USLEEP -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4
### The compiler options:
export CFLAGS = $(call PKGCFG,cflags) $(SQLITE_CFLAGS)
export CXXFLAGS = $(call PKGCFG,cxxflags) -std=gnu++11 -Wno-deprecated-declarations
### The version number of VDR's plugin API:
APIVERSION = $(call PKGCFG,apiversion)
### Allow user defined options to overwrite defaults:
-include $(PLGCFG)
### The name of the distribution archive:
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
### The name of the shared object file:
SOFILE = libvdr-$(PLUGIN).so
### Includes and Defines (add further entries here):
INCLUDES += -I./src -I./src/demuxer/include -I./src/demuxer/src -I./src/vdr -I../../../include $(AVAHI_CFLAGS)
ifndef LIBSQLITE
INCLUDES += -I./src/sqlite3
SQLITE_OBJS = src/db/sqlite3.o
SQLITE_LIBS =
else
SQLITE_OBJS =
SQLITE_LIBS = -lsqlite3
endif
ifdef DEBUG
INCLUDES += -DDEBUG
endif
DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DROBOTV_VERSION='"$(VERSION)"' -DHAVE_ZLIB=1
### The object files (add further files here):
SDP_OBJS = src/net/sdp.o
SDP_LIBS =
ifeq ($(AVAHI_ENABLED),1)
SDP_OBJS += src/net/sdp-avahi.o
DEFINES += -DAVAHI_ENABLED
endif
OBJS = \
src/config/config.o \
src/db/database.o \
src/db/storage.o \
src/demuxer/src/demuxer.o \
src/demuxer/src/demuxerbundle.o \
src/demuxer/src/streambundle.o \
src/demuxer/src/streaminfo.o \
src/demuxer/src/parsers/parser_ac3.o \
src/demuxer/src/parsers/parser_adts.o \
src/demuxer/src/parsers/parser_h264.o \
src/demuxer/src/parsers/parser_h265.o \
src/demuxer/src/parsers/parser_latm.o \
src/demuxer/src/parsers/parser_mpegaudio.o \
src/demuxer/src/parsers/parser_mpegvideo.o \
src/demuxer/src/parsers/parser_pes.o \
src/demuxer/src/parsers/parser_subtitle.o \
src/demuxer/src/parsers/parser.o \
src/demuxer/src/upstream/ringbuffer.o \
src/demuxer/src/upstream/bitstream.o \
src/live/channelcache.o \
src/live/livequeue.o \
src/live/livestreamer.o \
src/net/msgpacket.o \
src/net/os-config.o \
$(SDP_OBJS) \
src/recordings/artwork.o \
src/recordings/recordingscache.o \
src/recordings/packetplayer.o \
src/recordings/recplayer.o \
src/scanner/wirbelscan.o \
src/tools/hash.o \
src/tools/recid2uid.o \
src/tools/time.o \
src/tools/urlencode.o \
src/tools/utf8conv.o \
src/robotv/controllers/streamcontroller.o \
src/robotv/controllers/recordingcontroller.o \
src/robotv/controllers/channelcontroller.o \
src/robotv/controllers/timercontroller.o \
src/robotv/controllers/moviecontroller.o \
src/robotv/controllers/logincontroller.o \
src/robotv/controllers/epgcontroller.o \
src/robotv/controllers/artworkcontroller.o \
src/robotv/svdrp/channelcmds.o \
src/robotv/robotv.o \
src/robotv/robotvclient.o \
src/robotv/robotvserver.o \
src/robotv/StreamPacketProcessor.o
LIBS = -lz $(AVAHI_LIBS) $(SQLITE_LIBS)
### The main target:
all: $(SOFILE)
### Implicit rules:
src/db/sqlite3.o: src/db/sqlite3.c
@echo "CC $<"
@$(CC) $(CFLAGS) -fPIC -c $(DEFINES) $(INCLUDES) -o $@ $<
%.o: %.cpp
@echo "CXX $<"
@$(CXX) $(CXXFLAGS) -fPIC -c $(DEFINES) $(INCLUDES) -o $@ $<
### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@
-include $(DEPFILE)
### Targets:
$(SOFILE): $(OBJS) $(SQLITE_OBJS)
@echo "LINK $@"
@$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(SQLITE_OBJS) $(LIBS) -o $@
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
install-conf:
install -Dm644 config/allowed_hosts.conf $(DESTDIR)$(CFGDIR)/allowed_hosts.conf
install -Dm644 config/$(PLUGIN).conf $(DESTDIR)$(CFGDIR)/$(PLUGIN).conf
install: install-lib
dist: $(I18Npo) clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz
clean:
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
@-rm -f $(OBJS) $(SQLITE_OBJS) $(DEPFILE) *.so *.tgz core* *~
astyle:
astyle --exclude=src/db/sqlite3.h --exclude=src/db/sqlite3ext.h --options=./astylerc -r "src/*.cpp" "src/*.h"
run-container:
. .devcontainer/env ; ./docker/bin/runvdr.sh
.PHONY: i18n astyle clean