2 # MP3/MPlayer plugin to VDR
4 # (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
6 # This code is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This code is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # Or, point your browser to http://www.gnu.org/copyleft/gpl.html
21 # You can change the compile options here or create a Make.config
22 # in the VDR directory an set them there.
24 ### uncomment one of these lines, if you don't want one of the plugins
28 ### uncomment the following line, if you don't have libsndfile installed
31 ### uncomment the following line, if you don't have libvorbisfile installed
32 #WITHOUT_LIBVORBISFILE=1
34 ### uncomment the following line, if you want OSS sound output
37 ### uncomment the following line, if you want to include debug symbols
40 ### The C++ compiler and options:
42 CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual
44 ###############################################
45 ###############################################
47 # no user configurable options below this point
49 ###############################################
50 ###############################################
52 ### The directory environment:
58 # The official name of this plugin.
59 # This name will be used in the '-P...' option of VDR to load the plugin.
60 # By default the main source file also carries this name.
65 ### Allow user defined options to overwrite defaults:
67 -include $(VDRDIR)/Make.config
70 ### The version number of this plugin:
72 RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
73 VERSION := $(shell if test -d .hg; then echo -n '$(RELEASE)-'; (hg identify 2>/dev/null || echo -n Unknown) | sed -e 's/ .*//'; else echo -n '$(RELEASE)'; fi)
75 ### The version number of VDR (taken from VDR's "config.h"):
77 VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
78 APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
79 ifeq ($(strip $(APIVERSION)),)
80 APIVERSION = $(VDRVERSION)
82 VDRVERSNUM := $(shell sed -ne '/define VDRVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
83 APIVERSNUM := $(shell sed -ne '/define APIVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
84 ifeq ($(strip $(APIVERSNUM)),)
85 APIVERSNUM = $(VDRVERSNUM)
88 ### The name of the distribution archive:
90 ARCHIVE = $(PLUGIN)-$(VERSION)
91 PACKAGE = vdr-$(ARCHIVE)
93 ### Includes and Defines (add further entries here):
95 INCLUDES += -I$(VDRDIR)/include
96 DEFINES += -D_GNU_SOURCE -DAPIVERSNUM=$(APIVERSNUM)
98 ### The object files (add further files here):
101 ALL += libvdr-$(PLUGIN).so
102 ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
103 ALL += i18n-$(PLUGIN)
106 ifndef WITHOUT_MPLAYER
107 ALL += libvdr-$(PLUGIN2).so
108 ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
109 ALL += i18n-$(PLUGIN2)
113 COM_OBJS = i18n.o data.o menu.o version.o
115 OBJS = $(PLUGIN).o $(COM_OBJS)\
116 data-mp3.o setup-mp3.o player-mp3.o stream.o network.o\
117 decoder.o decoder-mp3.o decoder-mp3-stream.o decoder-snd.o \
119 LIBS = -lmad -lid3tag
121 ifndef WITHOUT_LIBSNDFILE
123 DEFINES += -DHAVE_SNDFILE
125 ifndef WITHOUT_LIBVORBISFILE
126 LIBS += -lvorbisfile -lvorbis
127 DEFINES += -DHAVE_VORBISFILE
129 ifdef WITH_OSS_OUTPUT
130 DEFINES += -DWITH_OSS
133 DEFINES += -DBROKEN_PCM
136 OBJS2 = $(PLUGIN2).o $(COM_OBJS)\
137 setup-mplayer.o player-mplayer.o
140 ifeq ($(shell test -f $(VDRDIR)/fontsym.h ; echo $$?),0)
141 DEFINES += -DHAVE_BEAUTYPATCH
148 ### Internationalization (I18N):
151 I18Npot = $(PODIR)/mp3-mplayer.pot
152 I18Npots = $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))
153 I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(I18Npots)))
154 I18Nmsgs2 = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN2).mo,$(I18Npots)))
155 LOCALEDIR = $(VDRDIR)/locale
159 MAKEDEP = g++ -MM -MG
160 DEPFILE = .dependencies
161 DEPFILES = $(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c))
162 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
163 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
170 .PHONY: i18n-$(PLUGIN) i18n-$(PLUGIN2)
173 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
175 libvdr-$(PLUGIN).so: $(OBJS)
176 $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
177 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
179 libvdr-$(PLUGIN2).so: $(OBJS2)
180 $(CXX) $(CXXFLAGS) -shared $(OBJS2) $(LIBS2) -o $@
181 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
183 $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c )
184 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^
187 msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
193 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
197 i18n-$(PLUGIN): $(I18Nmsgs)
199 $(I18Nmsgs2): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN2).mo: $(PODIR)/%.mo
203 i18n-$(PLUGIN2): $(I18Nmsgs2)
206 @echo >$@.new "/* this file will be overwritten without warning */"; \
207 echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \
208 diff $@.new $@ >$@.diff 2>&1; \
209 if test -s $@.diff; then mv -f $@.new $@; fi; \
210 rm -f $@.new $@.diff;
213 @-rm -rf $(TMPDIR)/$(ARCHIVE)
214 @mkdir $(TMPDIR)/$(ARCHIVE)
215 @cp -a * $(TMPDIR)/$(ARCHIVE)
216 @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
217 @-rm -rf $(TMPDIR)/$(ARCHIVE)
218 @echo Distribution package created as $(PACKAGE).tar.gz
221 @-rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr-*.so $(PACKAGE).tar.gz core* *~
223 @-rm -f $(PODIR)/*.mo