# # Makefile for a Video Disk Recorder plugin # # $Id$ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. # By default the main source file also carries this name. # PLUGIN = audiorecorder ### The version number of this plugin (taken from the main source file): VERSION = $(shell grep 'const char \*cPluginAudiorecorder::VERSION *=' $(PLUGIN).c | awk '{ print $$5 }' | sed -e 's/[";]//g') ### The C++ compiler and options: CXX ?= g++ CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual ### The directory environment: VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp FFMDIR = /usr/include ### Allow user defined options to overwrite defaults: -include $(VDRDIR)/Make.config ### The version number of VDR's plugin API (taken from VDR's "config.h"): APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) ### The name of the distribution archive: ARCHIVE = $(PLUGIN)-$(VERSION) PACKAGE = vdr-$(ARCHIVE) ### Includes, Libs and Defines (add further entries here): INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include $(shell taglib-config --cflags) LIBS = $(shell taglib-config --libs) DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DTIXML_USE_STL ifdef AUDIORECORDER_DEVEL DEFINES += -DAUDIORECORDER_DEVEL endif # ffmpeg AVCODEC_INC = $(shell pkg-config libavcodec --cflags | sed -e 's/ //g') ifeq ($(strip $(AVCODEC_INC)),) INCLUDES += -I$(FFMDIR) -I$(FFMDIR)/libavcodec else INCLUDES += $(AVCODEC_INC) endif AVCODEC_LIBS = $(shell pkg-config libavcodec --libs) ifeq ($(strip $(AVCODEC_LIBS)),) LIBS += -lavcodec else LIBS += $(AVCODEC_LIBS) endif ### The object files (add further files here): OBJS = $(PLUGIN).o mainmenu.o browse.o browse-item.o column.o dispatcher.o audioreceiver.o postdata.o trackinfo.o postproc.o rds.o convert.o cache.o xml-cache.o xml-base.o setup.o mpa-frame.o tinyxml/tinyxml.o tinyxml/tinyxmlerror.o tinyxml/tinyxmlparser.o audiorecorder_i18n.o ### Implicit rules: %.o: %.c $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< # Dependencies: MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ -include $(DEPFILE) ### Internationalization (I18N): PODIR = po LOCALEDIR = $(VDRDIR)/locale I18Npo = $(wildcard $(PODIR)/*.po) I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) I18Ndirs = $(notdir $(foreach file, $(I18Npo), $(basename $(file)))) I18Npot = $(PODIR)/$(PLUGIN).pot I18Nvdrmo = vdr-$(PLUGIN).mo ifeq ($(strip $(APIVERSION)),1.5.7) I18Nvdrmo = $(PLUGIN).mo endif %.mo: %.po msgfmt -c -o $@ $< $(I18Npot): $(OBJS:%.o=%.c) xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $(OBJS:%.o=%.c) $(I18Npo): $(I18Npot) msgmerge -U --no-wrap -F --backup=none -q $@ $< i18n: $(I18Nmo) @mkdir -p $(LOCALEDIR) for i in $(I18Ndirs); do\ mkdir -p $(LOCALEDIR)/$$i/LC_MESSAGES;\ cp $(PODIR)/$$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/$(I18Nvdrmo);\ done generate-i18n: i18n-template.h $(I18Npot) $(I18Npo) buildutil/pot2i18n.pl buildutil/pot2i18n.pl $(I18Npot) i18n-template.h > i18n-generated.h ### Targets: all: libvdr-$(PLUGIN).so i18n libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@ @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as $(PACKAGE).tgz clean: @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~