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
54 ### The object files (add further files here):
56 OBJS = $(PLUGIN).o dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
57 ringbuffer.o mvprelay.o vompclientrrproc.o \
58 config.o log.o thread.o tftpclient.o \
59 media.o responsepacket.o \
60 mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
62 OBJS2 = recplayer.o mvpreceiver.o
67 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
72 DEPFILE = .dependencies
74 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
80 all: allbase libvdr-$(PLUGIN).so
81 standalone: standalonebase vompserver-standalone
83 objectsstandalone: $(OBJS)
84 objects: $(OBJS) $(OBJS2)
87 ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
89 ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
91 libvdr-$(PLUGIN).so: objects
92 $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
93 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
95 vompserver-standalone: objectsstandalone
96 $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
100 @-rm -rf $(TMPDIR)/$(ARCHIVE)
101 @mkdir $(TMPDIR)/$(ARCHIVE)
102 @cp -a * $(TMPDIR)/$(ARCHIVE)
103 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
104 @-rm -rf $(TMPDIR)/$(ARCHIVE)
105 @echo Distribution package created as $(PACKAGE).tgz
108 rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so.* *.tgz core* *~ .standalone vompserver-standalone