]> git.vomp.tv Git - vompserver.git/blob - Makefile
Fix for broken teletext on recent VDR, from MartenR and hondansx
[vompserver.git] / Makefile
1 #
2 # Makefile for a Video Disk Recorder plugin
3 #
4 # $Id: Makefile,v 1.17 2009/05/30 14:22:59 christallon Exp $
5
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.
9 #
10 PLUGIN = vompserver
11
12 ### The version number of this plugin (taken from the main source file):
13
14 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
15
16 ### The C++ compiler and options:
17
18 CXX      ?= g++
19 ifdef DEBUG
20 CXXFLAGS ?= -g -Wall -Woverloaded-virtual -Wno-parentheses -Werror
21 else
22 CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual -Wno-parentheses -Werror
23 endif
24
25 ### The directory environment:
26
27 VDRDIR = ../../..
28 LIBDIR = ../../lib
29 TMPDIR = /tmp
30
31 ### Make sure that necessary options are included:
32
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
36 endif
37
38 ### Allow user defined options to overwrite defaults:
39
40 -include $(VDRDIR)/Make.config
41
42 ### read standlone settings if there
43 -include .standalone
44
45 ### The version number of VDR (taken from VDR's "config.h"):
46
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)
49
50 ### The name of the distribution archive:
51
52 ARCHIVE = $(PLUGIN)-$(VERSION)
53 PACKAGE = vdr-$(ARCHIVE)
54
55 ### Includes and Defines (add further entries here):
56
57 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
58
59 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVOMPSERVER
60 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
61
62 ### The object files (add further files here):
63
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
69
70 OBJS2 = recplayer.o mvpreceiver.o
71
72 ### Implicit rules:
73
74 %.o: %.c
75         $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
76
77 # Dependencies:
78
79 MAKEDEP = g++ -MM -MG
80 DEPFILE = .dependencies
81 $(DEPFILE): Makefile
82         @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
83
84 -include $(DEPFILE)
85
86 ### Targets:
87
88 all: allbase libvdr-$(PLUGIN).so
89 standalone: standalonebase vompserver-standalone
90
91 objectsstandalone: $(OBJS)
92 objects: $(OBJS) $(OBJS2)
93
94 allbase:
95         ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
96 standalonebase:
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 )
98
99 libvdr-$(PLUGIN).so: objects
100         $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
101         @cp $@ $(LIBDIR)/$@.$(APIVERSION)
102
103 vompserver-standalone: objectsstandalone
104         $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
105         chmod u+x $@
106
107 dist: clean
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
114
115 clean:
116         rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so* *.tgz core* *~ .standalone vompserver-standalone
117