2 # Makefile for a Video Disk Recorder plugin
6 # The official name of this plugin.
7 # This name will be used in the '-P...' option of VDR to load the plugin.
8 # By default the main source file also carries this name.
12 ### The version number of this plugin (taken from the main source file):
14 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
16 ### The directory environment:
18 # Use package data if installed...otherwise assume we're under the VDR source directory:
19 PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
20 LIBDIR = $(call PKGCFG,libdir)
21 LOCDIR = $(call PKGCFG,locdir)
22 PLGCFG = $(call PKGCFG,plgcfg)
26 # VOMP INSERT for older VDRs
34 APIVERSNUM = $(shell grep 'define APIVERSNUM ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
36 ifeq ($(shell test $(APIVERSNUM) -le 10734; echo $$?),0) # thanks streamdev
41 ### The compiler options:
43 export CFLAGS = $(call PKGCFG,cflags)
44 export CXXFLAGS = $(call PKGCFG,cxxflags)
51 ### The version number of VDR's plugin API:
53 APIVERSION = $(call PKGCFG,apiversion)
54 # VOMP INSERT for older VDRs
56 APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
60 ### Allow user defined options to overwrite defaults:
64 ### The name of the distribution archive:
66 ARCHIVE = $(PLUGIN)-$(VERSION)
67 PACKAGE = vdr-$(ARCHIVE)
69 ### The name of the shared object file:
71 SOFILE = libvdr-$(PLUGIN).so
73 ### Includes and Defines (add further entries here):
77 DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
80 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
82 DEFINES += -D_GNU_SOURCE -DVOMPSERVER
83 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
88 ### The object files (add further files here):
93 OBJS += dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
94 ringbuffer.o mvprelay.o vompclientrrproc.o \
95 config.o log.o thread.o tftpclient.o \
96 media.o responsepacket.o \
97 mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
99 OBJS2 = recplayer.o mvpreceiver.o
105 all: allbase $(SOFILE) # i18n
106 standalone: standalonebase vompserver-standalone
112 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
116 MAKEDEP = $(CXX) -MM -MG
117 DEPFILE = .dependencies
119 @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
123 ### Internationalization (I18N):
126 I18Npo = $(wildcard $(PODIR)/*.po)
127 I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
128 I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
129 I18Npot = $(PODIR)/$(PLUGIN).pot
134 $(I18Npot): $(wildcard *.c)
135 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
138 msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
141 $(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
142 install -D -m644 $< $@
145 i18n: $(I18Nmo) $(I18Npot)
147 install-i18n: $(I18Nmsgs)
151 # rest of file modified for vomp
153 objectsstandalone: $(OBJS)
154 objects: $(OBJS) $(OBJS2)
157 ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
159 ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
162 $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(OBJS2) -o $@
163 @if [ -n "$(DOOLDINSTALL)" ]; then \
164 @cp $@ $(LIBDIR)/$@.$(APIVERSION) ; \
165 @echo "done manual copy"; \
168 vompserver-standalone: objectsstandalone
169 $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
172 install-lib: $(SOFILE)
173 install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
175 install: install-lib install-i18n
177 dist: $(I18Npo) clean
178 @-rm -rf $(TMPDIR)/$(ARCHIVE)
179 @mkdir $(TMPDIR)/$(ARCHIVE)
180 @cp -a * $(TMPDIR)/$(ARCHIVE)
181 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
182 @-rm -rf $(TMPDIR)/$(ARCHIVE)
183 @echo Distribution package created as $(PACKAGE).tgz
186 @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
187 @-rm -f $(OBJS) $(OBJS2) $(DEPFILE) *.so *.tgz core* *~ .standalone vompserver-standalone