]> git.vomp.tv Git - vompserver.git/blob - Makefile
Makefile changes as per VDR HISTORY file
[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 include $(VDRDIR)/Make.global
34
35 ### Allow user defined options to overwrite defaults:
36
37 -include $(VDRDIR)/Make.config
38
39 ### read standlone settings if there
40 -include .standalone
41
42 ### The version number of VDR (taken from VDR's "config.h"):
43
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)
46
47 ### The name of the distribution archive:
48
49 ARCHIVE = $(PLUGIN)-$(VERSION)
50 PACKAGE = vdr-$(ARCHIVE)
51
52 ### Includes and Defines (add further entries here):
53
54 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
55
56 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVOMPSERVER
57 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
58
59 ### The object files (add further files here):
60
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
66
67 OBJS2 = recplayer.o mvpreceiver.o
68
69 ### Implicit rules:
70
71 %.o: %.c
72         $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
73
74 # Dependencies:
75
76 MAKEDEP = g++ -MM -MG
77 DEPFILE = .dependencies
78 $(DEPFILE): Makefile
79         @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
80
81 -include $(DEPFILE)
82
83 ### Targets:
84
85 all: allbase libvdr-$(PLUGIN).so
86 standalone: standalonebase vompserver-standalone
87
88 objectsstandalone: $(OBJS)
89 objects: $(OBJS) $(OBJS2)
90
91 allbase:
92         ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
93 standalonebase:
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 )
95
96 libvdr-$(PLUGIN).so: objects
97         $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
98         @cp $@ $(LIBDIR)/$@.$(APIVERSION)
99
100 vompserver-standalone: objectsstandalone
101         $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
102         chmod u+x $@
103
104 dist: clean
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
111
112 clean:
113         rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so.* *.tgz core* *~ .standalone vompserver-standalone
114