2 # Makefile for a Video Disk Recorder plugin
4 # $Id: Makefile,v 1.17 2009/05/30 14:22:59 christallon Exp $
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 -Wall -Woverloaded-virtual -Wno-parentheses -Werror
22 CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual -Wno-parentheses -Werror
25 ### The directory environment:
31 ### Make sure that necessary options are included:
33 APIVERSNUM = $(shell grep 'define APIVERSNUM ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
34 ifeq ($(shell test $(APIVERSNUM) -ge 10713; echo $$?),0) # thanks streamdev
35 include $(VDRDIR)/Make.global
38 ### Allow user defined options to overwrite defaults:
40 -include $(VDRDIR)/Make.config
42 ### read standlone settings if there
45 ### The version number of VDR (taken from VDR's "config.h"):
47 VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
48 APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
50 ### The name of the distribution archive:
52 ARCHIVE = $(PLUGIN)-$(VERSION)
53 PACKAGE = vdr-$(ARCHIVE)
55 ### Includes and Defines (add further entries here):
57 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
59 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVOMPSERVER
60 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
62 ### The object files (add further files here):
64 OBJS = $(PLUGIN).o dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
65 ringbuffer.o mvprelay.o vompclientrrproc.o \
66 config.o log.o thread.o tftpclient.o \
67 media.o responsepacket.o \
68 mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
70 OBJS2 = recplayer.o mvpreceiver.o
75 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
80 DEPFILE = .dependencies
82 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
88 all: allbase libvdr-$(PLUGIN).so
89 standalone: standalonebase vompserver-standalone
91 objectsstandalone: $(OBJS)
92 objects: $(OBJS) $(OBJS2)
95 ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
97 ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
99 libvdr-$(PLUGIN).so: objects
100 $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
101 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
103 vompserver-standalone: objectsstandalone
104 $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
108 @-rm -rf $(TMPDIR)/$(ARCHIVE)
109 @mkdir $(TMPDIR)/$(ARCHIVE)
110 @cp -a * $(TMPDIR)/$(ARCHIVE)
111 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
112 @-rm -rf $(TMPDIR)/$(ARCHIVE)
113 @echo Distribution package created as $(PACKAGE).tgz
116 rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so* *.tgz core* *~ .standalone vompserver-standalone