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 include $(VDRDIR)/Make.global
35 ### Allow user defined options to overwrite defaults:
37 -include $(VDRDIR)/Make.config
39 ### read standlone settings if there
42 ### The version number of VDR (taken from VDR's "config.h"):
44 VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
45 APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
47 ### The name of the distribution archive:
49 ARCHIVE = $(PLUGIN)-$(VERSION)
50 PACKAGE = vdr-$(ARCHIVE)
52 ### Includes and Defines (add further entries here):
54 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
56 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVOMPSERVER
57 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
59 ### The object files (add further files here):
61 OBJS = $(PLUGIN).o dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
62 ringbuffer.o mvprelay.o vompclientrrproc.o \
63 config.o log.o thread.o tftpclient.o \
64 media.o responsepacket.o \
65 mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
67 OBJS2 = recplayer.o mvpreceiver.o
72 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
77 DEPFILE = .dependencies
79 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
85 all: allbase libvdr-$(PLUGIN).so
86 standalone: standalonebase vompserver-standalone
88 objectsstandalone: $(OBJS)
89 objects: $(OBJS) $(OBJS2)
92 ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
94 ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
96 libvdr-$(PLUGIN).so: objects
97 $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
98 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
100 vompserver-standalone: objectsstandalone
101 $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
105 @-rm -rf $(TMPDIR)/$(ARCHIVE)
106 @mkdir $(TMPDIR)/$(ARCHIVE)
107 @cp -a * $(TMPDIR)/$(ARCHIVE)
108 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
109 @-rm -rf $(TMPDIR)/$(ARCHIVE)
110 @echo Distribution package created as $(PACKAGE).tgz
113 rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so* *.tgz core* *~ .standalone vompserver-standalone