]> git.vomp.tv Git - vompserver.git/blob - Makefile
Version number
[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 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
54
55 ### The object files (add further files here):
56
57 OBJS = $(PLUGIN).o dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
58                    ringbuffer.o mvprelay.o vompclientrrproc.o \
59                    config.o log.o thread.o tftpclient.o \
60                    media.o responsepacket.o \
61                    mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
62
63 OBJS2 = recplayer.o mvpreceiver.o
64
65 ### Implicit rules:
66
67 %.o: %.c
68         $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
69
70 # Dependencies:
71
72 MAKEDEP = g++ -MM -MG
73 DEPFILE = .dependencies
74 $(DEPFILE): Makefile
75         @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
76
77 -include $(DEPFILE)
78
79 ### Targets:
80
81 all: allbase libvdr-$(PLUGIN).so
82 standalone: standalonebase vompserver-standalone
83
84 objectsstandalone: $(OBJS)
85 objects: $(OBJS) $(OBJS2)
86
87 allbase:
88         ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
89 standalonebase:
90         ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
91
92 libvdr-$(PLUGIN).so: objects
93         $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
94         @cp $@ $(LIBDIR)/$@.$(APIVERSION)
95
96 vompserver-standalone: objectsstandalone
97         $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
98         chmod u+x $@
99
100 dist: clean
101         @-rm -rf $(TMPDIR)/$(ARCHIVE)
102         @mkdir $(TMPDIR)/$(ARCHIVE)
103         @cp -a * $(TMPDIR)/$(ARCHIVE)
104         @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
105         @-rm -rf $(TMPDIR)/$(ARCHIVE)
106         @echo Distribution package created as $(PACKAGE).tgz
107
108 clean:
109         rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so.* *.tgz core* *~ .standalone vompserver-standalone
110