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:
19 CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual -Werror
21 ### The directory environment:
27 ### Allow user defined options to overwrite defaults:
29 -include $(VDRDIR)/Make.config
31 ### The version number of VDR (taken from VDR's "config.h"):
33 VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
34 APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
36 ### The name of the distribution archive:
38 ARCHIVE = $(PLUGIN)-$(VERSION)
39 PACKAGE = vdr-$(ARCHIVE)
41 ### Includes and Defines (add further entries here):
43 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include -Iremux -Ilibdvbmpeg
45 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
47 ### The object files (add further files here):
49 OBJS = $(PLUGIN).o dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o mvpclient.o tcp.o \
50 remux/ts2ps.o remux/ts2es.o remux/tsremux.o ringbuffer.o \
51 recplayer.o config.o log.o thread.o mvpreceiver.o tftpclient.o
54 libdvbmpeg/libdvbmpegtools.a: libdvbmpeg/*.c libdvbmpeg/*.cc libdvbmpeg/*.h libdvbmpeg/*.hh
55 make -C ./libdvbmpeg libdvbmpegtools.a
61 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
66 DEPFILE = .dependencies
68 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
74 all: libvdr-$(PLUGIN).so
76 libvdr-$(PLUGIN).so: $(OBJS) libdvbmpeg/libdvbmpegtools.a
77 $(CXX) $(CXXFLAGS) -shared $(OBJS) libdvbmpeg/libdvbmpegtools.a -o $@
78 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
81 @-rm -rf $(TMPDIR)/$(ARCHIVE)
82 @mkdir $(TMPDIR)/$(ARCHIVE)
83 @cp -a * $(TMPDIR)/$(ARCHIVE)
84 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
85 @-rm -rf $(TMPDIR)/$(ARCHIVE)
86 @echo Distribution package created as $(PACKAGE).tgz
89 make -C libdvbmpeg clean
90 rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ remux/*.o