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 C++ compiler and options:
20 CXXFLAGS ?= -g -fPIC -Wall -Woverloaded-virtual #-Werror
22 CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual #-Werror
25 ### The directory environment:
31 ### Allow user defined options to overwrite defaults:
33 -include $(VDRDIR)/Make.config
35 ### read standlone settings if there
38 ### The version number of VDR (taken from VDR's "config.h"):
40 VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
41 APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
43 ### The name of the distribution archive:
45 ARCHIVE = $(PLUGIN)-$(VERSION)
46 PACKAGE = vdr-$(ARCHIVE)
48 ### Includes and Defines (add further entries here):
50 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
52 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVOMPSERVER
53 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
55 ### The object files (add further files here):
57 OBJS = $(PLUGIN).o dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
58 ringbuffer.o mvprelay.o vompclientrrproc.o \
59 config.o log.o thread.o tftpclient.o \
60 media.o responsepacket.o \
61 mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
63 OBJS2 = recplayer.o mvpreceiver.o
68 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
73 DEPFILE = .dependencies
75 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
81 all: allbase libvdr-$(PLUGIN).so
82 standalone: standalonebase vompserver-standalone
84 objectsstandalone: $(OBJS)
85 objects: $(OBJS) $(OBJS2)
88 ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
90 ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
92 libvdr-$(PLUGIN).so: objects
93 $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
94 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
96 vompserver-standalone: objectsstandalone
97 $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
101 @-rm -rf $(TMPDIR)/$(ARCHIVE)
102 @mkdir $(TMPDIR)/$(ARCHIVE)
103 @cp -a * $(TMPDIR)/$(ARCHIVE)
104 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
105 @-rm -rf $(TMPDIR)/$(ARCHIVE)
106 @echo Distribution package created as $(PACKAGE).tgz
109 rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so.* *.tgz core* *~ .standalone vompserver-standalone