]> git.vomp.tv Git - vompserver.git/blob - Makefile
Makefile made backward compatible with VDR 1.7.26
[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 directory environment:
17
18 # Use package data if installed...otherwise assume we're under the VDR source directory:
19 PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
20 LIBDIR = $(call PKGCFG,libdir)
21 LOCDIR = $(call PKGCFG,locdir)
22 PLGCFG = $(call PKGCFG,plgcfg)
23 #
24 TMPDIR ?= /tmp
25
26 # VOMP INSERT for older VDRs
27 ifeq ($(VDRDIR),)
28   VDRDIR = ../../..
29   LIBDIR = ../../lib
30 endif
31
32 APIVERSNUM = $(shell grep 'define APIVERSNUM ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
33 DOOLDINSTALL = 0
34 ifeq ($(shell test $(APIVERSNUM) -le 10734; echo $$?),0) # thanks streamdev
35 DOOLDINSTALL = 1
36 endif
37 # end insert
38
39 ### The compiler options:
40
41 export CFLAGS   = $(call PKGCFG,cflags)
42 export CXXFLAGS = $(call PKGCFG,cxxflags)
43
44 # VOMP INSERT
45 CFLAGS += -fPIC
46 CXXFLAGS += -fPIC
47 # end insert
48
49 ### The version number of VDR's plugin API:
50
51 APIVERSION = $(call PKGCFG,apiversion)
52
53 ### Allow user defined options to overwrite defaults:
54
55 -include $(PLGCFG)
56
57 ### The name of the distribution archive:
58
59 ARCHIVE = $(PLUGIN)-$(VERSION)
60 PACKAGE = vdr-$(ARCHIVE)
61
62 ### The name of the shared object file:
63
64 SOFILE = libvdr-$(PLUGIN).so
65
66 ### Includes and Defines (add further entries here):
67
68 INCLUDES +=
69
70 DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
71
72 # VOMP-INSERT
73 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
74
75 DEFINES += -D_GNU_SOURCE -DVOMPSERVER
76 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
77
78 # END-VOMP-INSERT
79
80
81 ### The object files (add further files here):
82
83 OBJS = $(PLUGIN).o
84
85 # VOMP-INSERT
86 OBJS += dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
87                    ringbuffer.o mvprelay.o vompclientrrproc.o \
88                    config.o log.o thread.o tftpclient.o \
89                    media.o responsepacket.o \
90                    mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
91
92 OBJS2 = recplayer.o mvpreceiver.o
93 # END-VOMP-INSERT
94
95 ### The main target:
96
97 # VOMP-INSERT
98 all: allbase $(SOFILE) # i18n
99 standalone: standalonebase vompserver-standalone
100 # END-VOMP-INSERT
101
102 ### Implicit rules:
103
104 %.o: %.c
105         $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
106
107 ### Dependencies:
108
109 MAKEDEP = $(CXX) -MM -MG
110 DEPFILE = .dependencies
111 $(DEPFILE): Makefile
112         @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
113
114 -include $(DEPFILE)
115
116 ### Internationalization (I18N):
117
118 PODIR     = po
119 I18Npo    = $(wildcard $(PODIR)/*.po)
120 I18Nmo    = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
121 I18Nmsgs  = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
122 I18Npot   = $(PODIR)/$(PLUGIN).pot
123
124 %.mo: %.po
125         msgfmt -c -o $@ $<
126
127 $(I18Npot): $(wildcard *.c)
128         xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
129
130 %.po: $(I18Npot)
131         msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
132         @touch $@
133
134 $(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
135         install -D -m644 $< $@
136
137 .PHONY: i18n
138 i18n: $(I18Nmo) $(I18Npot)
139
140 install-i18n: $(I18Nmsgs)
141
142 ### Targets:
143
144 # rest of file modified for vomp
145
146 objectsstandalone: $(OBJS)
147 objects: $(OBJS) $(OBJS2)
148
149 allbase:
150         ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
151 standalonebase:
152         ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
153
154 $(SOFILE): objects
155         $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(OBJS2) -o $@
156         [ -n "$(DOOLDINSTALL)" ]; then \
157 cp $@ $(LIBDIR)/$@.$(APIVERSION) ; \
158 fi
159
160 vompserver-standalone: objectsstandalone
161         $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
162         chmod u+x $@
163
164 install-lib: $(SOFILE)
165         install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
166
167 install: install-lib install-i18n
168
169 dist: $(I18Npo) clean
170         @-rm -rf $(TMPDIR)/$(ARCHIVE)
171         @mkdir $(TMPDIR)/$(ARCHIVE)
172         @cp -a * $(TMPDIR)/$(ARCHIVE)
173         @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
174         @-rm -rf $(TMPDIR)/$(ARCHIVE)
175         @echo Distribution package created as $(PACKAGE).tgz
176
177 clean:
178         @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
179         @-rm -f $(OBJS) $(OBJS2) $(DEPFILE) *.so *.tgz core* *~ .standalone vompserver-standalone