nathan@0: # nathan@0: # MP3/MPlayer plugin to VDR nathan@0: # nathan@2: # (C) 2001-2007 Stefan Huelswitt nathan@0: # nathan@0: # This code is free software; you can redistribute it and/or nathan@0: # modify it under the terms of the GNU General Public License nathan@0: # as published by the Free Software Foundation; either version 2 nathan@0: # of the License, or (at your option) any later version. nathan@0: # nathan@0: # This code is distributed in the hope that it will be useful, nathan@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of nathan@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nathan@0: # GNU General Public License for more details. nathan@0: # nathan@0: # You should have received a copy of the GNU General Public License nathan@0: # along with this program; if not, write to the Free Software nathan@0: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. nathan@0: # Or, point your browser to http://www.gnu.org/copyleft/gpl.html nathan@0: nathan@0: # You can change the compile options here or create a Make.config nathan@0: # in the VDR directory an set them there. nathan@0: nathan@0: ### uncomment one of these lines, if you don't want one of the plugins nathan@0: #WITHOUT_MP3=1 nathan@0: #WITHOUT_MPLAYER=1 nathan@0: nathan@0: ### uncomment the following line, if you don't have libsndfile installed nathan@0: #WITHOUT_LIBSNDFILE=1 nathan@0: nathan@0: ### uncomment the following line, if you don't have libvorbisfile installed nathan@0: #WITHOUT_LIBVORBISFILE=1 nathan@0: nathan@0: ### uncomment the following line, if you want OSS sound output nathan@0: #WITH_OSS_OUTPUT=1 nathan@0: nathan@0: ### uncomment the following line, if you want to include debug symbols nathan@0: #DBG=1 nathan@0: nathan@0: ### The C++ compiler and options: nathan@0: CXX ?= g++ nathan@0: CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual nathan@0: nathan@0: ############################################### nathan@0: ############################################### nathan@0: # nathan@0: # no user configurable options below this point nathan@0: # nathan@0: ############################################### nathan@0: ############################################### nathan@0: nathan@0: ### The directory environment: nathan@0: nathan@0: VDRDIR = ../../.. nathan@0: LIBDIR = ../../lib nathan@0: TMPDIR = /tmp nathan@0: nathan@0: # The official name of this plugin. nathan@0: # This name will be used in the '-P...' option of VDR to load the plugin. nathan@0: # By default the main source file also carries this name. nathan@0: # nathan@0: PLUGIN = mp3 nathan@0: PLUGIN2 = mplayer nathan@0: nathan@0: ### Allow user defined options to overwrite defaults: nathan@0: nathan@0: -include $(VDRDIR)/Make.config nathan@0: nathan@0: ### The version number of this plugin (taken from the main source file): nathan@0: nathan@0: VERSION = $(shell grep 'define PLUGIN_VERSION' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g') nathan@0: nathan@0: ### The version number of VDR (taken from VDR's "config.h"): nathan@0: nathan@0: VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) nathan@0: APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) nathan@0: ifeq ($(strip $(APIVERSION)),) nathan@0: APIVERSION = $(VDRVERSION) nathan@0: endif nathan@0: VDRVERSNUM = $(shell sed -ne '/define VDRVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h) nathan@0: APIVERSNUM = $(shell sed -ne '/define APIVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h) nathan@0: ifeq ($(strip $(APIVERSNUM)),) nathan@0: APIVERSNUM = $(VDRVERSNUM) nathan@0: endif nathan@0: nathan@0: ### The name of the distribution archive: nathan@0: nathan@0: ARCHIVE = $(PLUGIN)-$(VERSION) nathan@0: PACKAGE = vdr-$(ARCHIVE) nathan@0: nathan@0: ### Includes and Defines (add further entries here): nathan@0: nathan@0: INCLUDES += -I$(VDRDIR)/include nathan@0: DEFINES += -D_GNU_SOURCE -DAPIVERSNUM=$(APIVERSNUM) nathan@0: nathan@0: ### The object files (add further files here): nathan@0: nathan@0: ifndef WITHOUT_MP3 nathan@0: ALL += libvdr-$(PLUGIN).so nathan@2: ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c) nathan@2: ALL += i18n-$(PLUGIN) nathan@2: endif nathan@0: endif nathan@0: ifndef WITHOUT_MPLAYER nathan@0: ALL += libvdr-$(PLUGIN2).so nathan@2: ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c) nathan@2: ALL += i18n-$(PLUGIN2) nathan@2: endif nathan@0: endif nathan@0: nathan@0: COM_OBJS = i18n.o data.o menu.o nathan@0: nathan@0: OBJS = $(PLUGIN).o $(COM_OBJS)\ nathan@0: data-mp3.o setup-mp3.o player-mp3.o stream.o network.o\ nathan@0: decoder.o decoder-mp3.o decoder-mp3-stream.o decoder-snd.o \ nathan@0: decoder-ogg.o nathan@0: LIBS = -lmad -lid3tag nathan@0: nathan@0: ifndef WITHOUT_LIBSNDFILE nathan@0: LIBS += -lsndfile nathan@0: DEFINES += -DHAVE_SNDFILE nathan@0: endif nathan@0: ifndef WITHOUT_LIBVORBISFILE nathan@0: LIBS += -lvorbisfile -lvorbis nathan@0: DEFINES += -DHAVE_VORBISFILE nathan@0: endif nathan@0: ifdef WITH_OSS_OUTPUT nathan@0: DEFINES += -DWITH_OSS nathan@0: endif nathan@0: ifdef BROKEN_PCM nathan@0: DEFINES += -DBROKEN_PCM nathan@0: endif nathan@0: nathan@0: OBJS2 = $(PLUGIN2).o $(COM_OBJS)\ nathan@0: setup-mplayer.o player-mplayer.o nathan@0: LIBS2 = nathan@0: nathan@0: ifeq ($(shell test -f $(VDRDIR)/fontsym.h ; echo $$?),0) nathan@0: DEFINES += -DHAVE_BEAUTYPATCH nathan@0: endif nathan@0: nathan@0: ifdef DBG nathan@2: CXXFLAGS += -g nathan@2: endif nathan@2: nathan@2: ### Internationalization (I18N): nathan@2: nathan@2: PODIR = po nathan@2: I18Npot = $(PODIR)/mp3-mplayer.pot nathan@2: I18Npots = $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))) nathan@2: I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(I18Npots))) nathan@2: I18Nmsgs2 = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN2).mo,$(I18Npots))) nathan@2: LOCALEDIR = $(VDRDIR)/locale nathan@0: nathan@0: # Dependencies: nathan@0: nathan@0: MAKEDEP = g++ -MM -MG nathan@0: DEPFILE = .dependencies nathan@0: $(DEPFILE): Makefile nathan@0: @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) $(OBJS2:%.o=%.c) > $@ nathan@0: nathan@0: -include $(DEPFILE) nathan@0: nathan@0: ### Targets: nathan@0: nathan@0: all: $(ALL) nathan@2: .PHONY: i18n-$(PLUGIN) i18n-$(PLUGIN2) nathan@2: nathan@2: %.o: %.c nathan@2: $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< nathan@0: nathan@0: libvdr-$(PLUGIN).so: $(OBJS) nathan@0: $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@ nathan@0: @cp $@ $(LIBDIR)/$@.$(APIVERSION) nathan@0: nathan@0: libvdr-$(PLUGIN2).so: $(OBJS2) nathan@0: $(CXX) $(CXXFLAGS) -shared $(OBJS2) $(LIBS2) -o $@ nathan@0: @cp $@ $(LIBDIR)/$@.$(APIVERSION) nathan@0: nathan@2: $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR)) nathan@2: xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $^ nathan@2: nathan@2: %.po: $(I18Npot) nathan@2: msgmerge -U --no-wrap -F --backup=none -q $@ $< nathan@2: @touch $@ nathan@2: nathan@2: %.mo: %.po nathan@2: msgfmt -c -o $@ $< nathan@2: nathan@2: $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo nathan@2: @mkdir -p $(dir $@) nathan@2: cp $< $@ nathan@2: nathan@2: i18n-$(PLUGIN): $(I18Nmsgs) nathan@2: nathan@2: $(I18Nmsgs2): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN2).mo: $(PODIR)/%.mo nathan@2: @mkdir -p $(dir $@) nathan@2: cp $< $@ nathan@2: nathan@2: i18n-$(PLUGIN2): $(I18Nmsgs2) nathan@0: nathan@0: dist: clean nathan@0: @-rm -rf $(TMPDIR)/$(ARCHIVE) nathan@0: @mkdir $(TMPDIR)/$(ARCHIVE) nathan@0: @cp -a * $(TMPDIR)/$(ARCHIVE) nathan@0: @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE) nathan@0: @-rm -rf $(TMPDIR)/$(ARCHIVE) nathan@0: @echo Distribution package created as $(PACKAGE).tar.gz nathan@0: nathan@0: clean: nathan@2: @-rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr-*.so $(PACKAGE).tar.gz core* *~ nathan@2: @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot