nathan@0
|
1 |
#
|
nathan@0
|
2 |
# MP3/MPlayer plugin to VDR
|
nathan@0
|
3 |
#
|
nathan@25
|
4 |
# (C) 2001-2009 Stefan Huelswitt <s.huelswitt@gmx.de>
|
nathan@0
|
5 |
#
|
nathan@0
|
6 |
# This code is free software; you can redistribute it and/or
|
nathan@0
|
7 |
# modify it under the terms of the GNU General Public License
|
nathan@0
|
8 |
# as published by the Free Software Foundation; either version 2
|
nathan@0
|
9 |
# of the License, or (at your option) any later version.
|
nathan@0
|
10 |
#
|
nathan@0
|
11 |
# This code is distributed in the hope that it will be useful,
|
nathan@0
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
nathan@0
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
nathan@0
|
14 |
# GNU General Public License for more details.
|
nathan@0
|
15 |
#
|
nathan@0
|
16 |
# You should have received a copy of the GNU General Public License
|
nathan@0
|
17 |
# along with this program; if not, write to the Free Software
|
nathan@0
|
18 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
nathan@0
|
19 |
# Or, point your browser to http://www.gnu.org/copyleft/gpl.html
|
nathan@0
|
20 |
|
nathan@0
|
21 |
# You can change the compile options here or create a Make.config
|
nathan@0
|
22 |
# in the VDR directory an set them there.
|
nathan@0
|
23 |
|
nathan@0
|
24 |
### uncomment one of these lines, if you don't want one of the plugins
|
nathan@0
|
25 |
#WITHOUT_MP3=1
|
nathan@0
|
26 |
#WITHOUT_MPLAYER=1
|
nathan@0
|
27 |
|
nathan@0
|
28 |
### uncomment the following line, if you don't have libsndfile installed
|
nathan@0
|
29 |
#WITHOUT_LIBSNDFILE=1
|
nathan@0
|
30 |
|
nathan@0
|
31 |
### uncomment the following line, if you don't have libvorbisfile installed
|
nathan@0
|
32 |
#WITHOUT_LIBVORBISFILE=1
|
nathan@0
|
33 |
|
nathan@0
|
34 |
### uncomment the following line, if you want OSS sound output
|
nathan@0
|
35 |
#WITH_OSS_OUTPUT=1
|
nathan@0
|
36 |
|
nathan@0
|
37 |
### uncomment the following line, if you want to include debug symbols
|
nathan@0
|
38 |
#DBG=1
|
nathan@0
|
39 |
|
nathan@0
|
40 |
### The C++ compiler and options:
|
nathan@0
|
41 |
CXX ?= g++
|
nathan@0
|
42 |
CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual
|
nathan@0
|
43 |
|
nathan@0
|
44 |
###############################################
|
nathan@0
|
45 |
###############################################
|
nathan@0
|
46 |
#
|
nathan@0
|
47 |
# no user configurable options below this point
|
nathan@0
|
48 |
#
|
nathan@0
|
49 |
###############################################
|
nathan@0
|
50 |
###############################################
|
nathan@0
|
51 |
|
nathan@0
|
52 |
### The directory environment:
|
nathan@0
|
53 |
|
nathan@0
|
54 |
VDRDIR = ../../..
|
nathan@0
|
55 |
LIBDIR = ../../lib
|
nathan@0
|
56 |
TMPDIR = /tmp
|
nathan@0
|
57 |
|
nathan@0
|
58 |
# The official name of this plugin.
|
nathan@0
|
59 |
# This name will be used in the '-P...' option of VDR to load the plugin.
|
nathan@0
|
60 |
# By default the main source file also carries this name.
|
nathan@0
|
61 |
#
|
nathan@0
|
62 |
PLUGIN = mp3
|
nathan@0
|
63 |
PLUGIN2 = mplayer
|
nathan@0
|
64 |
|
nathan@0
|
65 |
### Allow user defined options to overwrite defaults:
|
nathan@0
|
66 |
|
nathan@0
|
67 |
-include $(VDRDIR)/Make.config
|
nathan@9
|
68 |
-include Make.config
|
nathan@9
|
69 |
|
nathan@9
|
70 |
### The version number of this plugin:
|
nathan@9
|
71 |
|
nathan@14
|
72 |
HGARCHIVE = .hg_archival.txt
|
nathan@9
|
73 |
RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
|
nathan@14
|
74 |
RELSTR := $(shell if test -d .hg; then \
|
nathan@14
|
75 |
echo -n "-"; (hg identify 2>/dev/null || echo -n "Unknown") | sed -e 's/ .*//'; \
|
nathan@14
|
76 |
elif test -r $(HGARCHIVE); then \
|
nathan@14
|
77 |
echo -n "-"; grep "^node" $(HGARCHIVE) | awk '{ printf "%.12s",$$2 }'; \
|
nathan@14
|
78 |
fi)
|
nathan@14
|
79 |
VERSION := $(RELEASE)$(RELSTR)
|
nathan@0
|
80 |
|
nathan@0
|
81 |
### The version number of VDR (taken from VDR's "config.h"):
|
nathan@0
|
82 |
|
nathan@11
|
83 |
VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
|
nathan@11
|
84 |
APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
|
nathan@0
|
85 |
ifeq ($(strip $(APIVERSION)),)
|
nathan@0
|
86 |
APIVERSION = $(VDRVERSION)
|
nathan@0
|
87 |
endif
|
nathan@11
|
88 |
VDRVERSNUM := $(shell sed -ne '/define VDRVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
|
nathan@11
|
89 |
APIVERSNUM := $(shell sed -ne '/define APIVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
|
nathan@0
|
90 |
ifeq ($(strip $(APIVERSNUM)),)
|
nathan@0
|
91 |
APIVERSNUM = $(VDRVERSNUM)
|
nathan@0
|
92 |
endif
|
nathan@0
|
93 |
|
nathan@0
|
94 |
### The name of the distribution archive:
|
nathan@0
|
95 |
|
nathan@14
|
96 |
ARCHIVE = $(PLUGIN)-$(RELEASE)
|
nathan@0
|
97 |
PACKAGE = vdr-$(ARCHIVE)
|
nathan@0
|
98 |
|
nathan@0
|
99 |
### Includes and Defines (add further entries here):
|
nathan@0
|
100 |
|
nathan@0
|
101 |
INCLUDES += -I$(VDRDIR)/include
|
nathan@0
|
102 |
DEFINES += -D_GNU_SOURCE -DAPIVERSNUM=$(APIVERSNUM)
|
nathan@0
|
103 |
|
nathan@0
|
104 |
### The object files (add further files here):
|
nathan@0
|
105 |
|
nathan@11
|
106 |
COM_OBJS = data.o menu.o version.o
|
nathan@0
|
107 |
|
nathan@0
|
108 |
OBJS = $(PLUGIN).o $(COM_OBJS)\
|
nathan@0
|
109 |
data-mp3.o setup-mp3.o player-mp3.o stream.o network.o\
|
nathan@0
|
110 |
decoder.o decoder-mp3.o decoder-mp3-stream.o decoder-snd.o \
|
nathan@25
|
111 |
decoder-ogg.o compat.o
|
nathan@0
|
112 |
LIBS = -lmad -lid3tag
|
nathan@0
|
113 |
|
nathan@0
|
114 |
ifndef WITHOUT_LIBSNDFILE
|
nathan@0
|
115 |
LIBS += -lsndfile
|
nathan@0
|
116 |
DEFINES += -DHAVE_SNDFILE
|
nathan@0
|
117 |
endif
|
nathan@0
|
118 |
ifndef WITHOUT_LIBVORBISFILE
|
nathan@0
|
119 |
LIBS += -lvorbisfile -lvorbis
|
nathan@0
|
120 |
DEFINES += -DHAVE_VORBISFILE
|
nathan@0
|
121 |
endif
|
nathan@0
|
122 |
ifdef WITH_OSS_OUTPUT
|
nathan@0
|
123 |
DEFINES += -DWITH_OSS
|
nathan@0
|
124 |
endif
|
nathan@0
|
125 |
ifdef BROKEN_PCM
|
nathan@0
|
126 |
DEFINES += -DBROKEN_PCM
|
nathan@0
|
127 |
endif
|
nathan@0
|
128 |
|
nathan@0
|
129 |
OBJS2 = $(PLUGIN2).o $(COM_OBJS)\
|
nathan@0
|
130 |
setup-mplayer.o player-mplayer.o
|
nathan@0
|
131 |
LIBS2 =
|
nathan@0
|
132 |
|
nathan@0
|
133 |
ifdef DBG
|
nathan@2
|
134 |
CXXFLAGS += -g
|
nathan@2
|
135 |
endif
|
nathan@2
|
136 |
|
nathan@26
|
137 |
ifneq ($(shell if test $(APIVERSNUM) -ge 010703; then echo "*"; fi),)
|
nathan@26
|
138 |
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
|
nathan@26
|
139 |
endif
|
nathan@26
|
140 |
|
nathan@2
|
141 |
### Internationalization (I18N):
|
nathan@2
|
142 |
|
nathan@2
|
143 |
PODIR = po
|
nathan@2
|
144 |
I18Npot = $(PODIR)/mp3-mplayer.pot
|
nathan@11
|
145 |
I18Npots := $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))
|
nathan@11
|
146 |
ifeq ($(strip $(APIVERSION)),1.5.7)
|
nathan@11
|
147 |
I18Nmo = $(PLUGIN).mo
|
nathan@11
|
148 |
I18Nmo2 = $(PLUGIN2).mo
|
nathan@11
|
149 |
else
|
nathan@11
|
150 |
I18Nmo = vdr-$(PLUGIN).mo
|
nathan@11
|
151 |
I18Nmo2 = vdr-$(PLUGIN2).mo
|
nathan@11
|
152 |
endif
|
nathan@2
|
153 |
LOCALEDIR = $(VDRDIR)/locale
|
nathan@11
|
154 |
I18Nmsgs := $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo),$(I18Npots)))
|
nathan@11
|
155 |
I18Nmsgs2 := $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo2),$(I18Npots)))
|
nathan@11
|
156 |
|
nathan@11
|
157 |
HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h)
|
nathan@11
|
158 |
ifeq ($(strip $(HASLOCALE)),)
|
nathan@11
|
159 |
COM_OBJS += i18n.o
|
nathan@11
|
160 |
endif
|
nathan@0
|
161 |
|
nathan@14
|
162 |
### Targets:
|
nathan@14
|
163 |
|
nathan@14
|
164 |
ifndef WITHOUT_MP3
|
nathan@14
|
165 |
ALL += libvdr-$(PLUGIN).so
|
nathan@14
|
166 |
ifneq ($(strip $(HASLOCALE)),)
|
nathan@14
|
167 |
ALL += i18n-$(PLUGIN)
|
nathan@14
|
168 |
endif
|
nathan@14
|
169 |
endif
|
nathan@14
|
170 |
ifndef WITHOUT_MPLAYER
|
nathan@14
|
171 |
ALL += libvdr-$(PLUGIN2).so
|
nathan@14
|
172 |
ifneq ($(strip $(HASLOCALE)),)
|
nathan@14
|
173 |
ALL += i18n-$(PLUGIN2)
|
nathan@14
|
174 |
endif
|
nathan@14
|
175 |
endif
|
nathan@14
|
176 |
|
nathan@14
|
177 |
all: $(ALL)
|
nathan@14
|
178 |
.PHONY: i18n-$(PLUGIN) i18n-$(PLUGIN2)
|
nathan@14
|
179 |
|
nathan@0
|
180 |
# Dependencies:
|
nathan@0
|
181 |
|
nathan@0
|
182 |
MAKEDEP = g++ -MM -MG
|
nathan@0
|
183 |
DEPFILE = .dependencies
|
nathan@11
|
184 |
DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c)))
|
nathan@9
|
185 |
$(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
|
nathan@9
|
186 |
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
|
nathan@0
|
187 |
|
nathan@0
|
188 |
-include $(DEPFILE)
|
nathan@0
|
189 |
|
nathan@14
|
190 |
# Rules
|
nathan@2
|
191 |
|
nathan@2
|
192 |
%.o: %.c
|
nathan@2
|
193 |
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
|
nathan@0
|
194 |
|
nathan@0
|
195 |
libvdr-$(PLUGIN).so: $(OBJS)
|
nathan@0
|
196 |
$(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
|
nathan@0
|
197 |
@cp $@ $(LIBDIR)/$@.$(APIVERSION)
|
nathan@0
|
198 |
|
nathan@0
|
199 |
libvdr-$(PLUGIN2).so: $(OBJS2)
|
nathan@0
|
200 |
$(CXX) $(CXXFLAGS) -shared $(OBJS2) $(LIBS2) -o $@
|
nathan@0
|
201 |
@cp $@ $(LIBDIR)/$@.$(APIVERSION)
|
nathan@0
|
202 |
|
nathan@5
|
203 |
$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c )
|
nathan@5
|
204 |
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^
|
nathan@2
|
205 |
|
nathan@2
|
206 |
%.po: $(I18Npot)
|
nathan@5
|
207 |
msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
|
nathan@2
|
208 |
@touch $@
|
nathan@2
|
209 |
|
nathan@2
|
210 |
%.mo: %.po
|
nathan@2
|
211 |
msgfmt -c -o $@ $<
|
nathan@2
|
212 |
|
nathan@11
|
213 |
$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo): $(PODIR)/%.mo
|
nathan@2
|
214 |
@mkdir -p $(dir $@)
|
nathan@2
|
215 |
cp $< $@
|
nathan@2
|
216 |
|
nathan@2
|
217 |
i18n-$(PLUGIN): $(I18Nmsgs)
|
nathan@2
|
218 |
|
nathan@11
|
219 |
$(I18Nmsgs2): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo2): $(PODIR)/%.mo
|
nathan@2
|
220 |
@mkdir -p $(dir $@)
|
nathan@2
|
221 |
cp $< $@
|
nathan@2
|
222 |
|
nathan@2
|
223 |
i18n-$(PLUGIN2): $(I18Nmsgs2)
|
nathan@0
|
224 |
|
nathan@11
|
225 |
i18n.c: $(PODIR)/*.po i18n-template.c po2i18n.pl
|
nathan@11
|
226 |
perl ./po2i18n.pl <i18n-template.c >i18n.c
|
nathan@11
|
227 |
|
nathan@9
|
228 |
version.c: FORCE
|
nathan@9
|
229 |
@echo >$@.new "/* this file will be overwritten without warning */"; \
|
nathan@9
|
230 |
echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \
|
nathan@9
|
231 |
diff $@.new $@ >$@.diff 2>&1; \
|
nathan@9
|
232 |
if test -s $@.diff; then mv -f $@.new $@; fi; \
|
nathan@9
|
233 |
rm -f $@.new $@.diff;
|
nathan@9
|
234 |
|
nathan@0
|
235 |
dist: clean
|
nathan@0
|
236 |
@-rm -rf $(TMPDIR)/$(ARCHIVE)
|
nathan@0
|
237 |
@mkdir $(TMPDIR)/$(ARCHIVE)
|
nathan@0
|
238 |
@cp -a * $(TMPDIR)/$(ARCHIVE)
|
nathan@0
|
239 |
@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
|
nathan@0
|
240 |
@-rm -rf $(TMPDIR)/$(ARCHIVE)
|
nathan@0
|
241 |
@echo Distribution package created as $(PACKAGE).tar.gz
|
nathan@0
|
242 |
|
nathan@0
|
243 |
clean:
|
nathan@2
|
244 |
@-rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr-*.so $(PACKAGE).tar.gz core* *~
|
nathan@11
|
245 |
@-rm -f version.c i18n.c
|
nathan@5
|
246 |
@-rm -f $(PODIR)/*.mo
|
nathan@9
|
247 |
|
nathan@9
|
248 |
FORCE: |