]> git.vomp.tv Git - vompserver.git/blob - Makefile
Vogel Media Player 2008-11-28
[vompserver.git] / Makefile
1 #
2 # Makefile for a Video Disk Recorder plugin
3 #
4 # $Id$
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 -fPIC -Wall -Woverloaded-virtual #-Werror
21 else
22 CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual #-Werror
23 endif
24
25 ### The directory environment:
26
27 VDRDIR = ../../..
28 LIBDIR = ../../lib
29 TMPDIR = /tmp
30
31 ### Allow user defined options to overwrite defaults:
32
33 -include $(VDRDIR)/Make.config
34
35 ### read standlone settings if there
36 -include .standalone
37
38 ### The version number of VDR (taken from VDR's "config.h"):
39
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)
42
43 ### The name of the distribution archive:
44
45 ARCHIVE = $(PLUGIN)-$(VERSION)
46 PACKAGE = vdr-$(ARCHIVE)
47
48 ### Includes and Defines (add further entries here):
49
50 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
51
52 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVOMPSERVER
53
54 ### The object files (add further files here):
55
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
61
62 OBJS2 = recplayer.o mvpreceiver.o
63
64 ### Implicit rules:
65
66 %.o: %.c
67         $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
68
69 # Dependencies:
70
71 MAKEDEP = g++ -MM -MG
72 DEPFILE = .dependencies
73 $(DEPFILE): Makefile
74         @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
75
76 -include $(DEPFILE)
77
78 ### Targets:
79
80 all: allbase libvdr-$(PLUGIN).so
81 standalone: standalonebase vompserver-standalone
82
83 objectsstandalone: $(OBJS)
84 objects: $(OBJS) $(OBJS2)
85
86 allbase:
87         ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
88 standalonebase:
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 )
90
91 libvdr-$(PLUGIN).so: objects
92         $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
93         @cp $@ $(LIBDIR)/$@.$(APIVERSION)
94
95 vompserver-standalone: objectsstandalone
96         $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
97         chmod u+x $@
98
99 dist: clean
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
106
107 clean:
108         rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so.* *.tgz core* *~ .standalone vompserver-standalone
109