nathan@0: # nathan@0: # PremiereEpg plugin to VDR nathan@0: # nathan@21: # (C) 2005-2008 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: # 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 = premiereepg nathan@0: nathan@20: ### The version number of this plugin: nathan@0: nathan@21: HGARCHIVE = .hg_archival.txt nathan@20: RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g') nathan@21: RELSTR := $(shell if test -d .hg; then \ nathan@21: echo -n "-"; (hg identify 2>/dev/null || echo -n "Unknown") | sed -e 's/ .*//'; \ nathan@21: elif test -r $(HGARCHIVE); then \ nathan@21: echo -n "-"; grep "^node" $(HGARCHIVE) | awk '{ printf "%.12s",$$2 }'; \ nathan@21: fi) nathan@21: VERSION := $(RELEASE)$(RELSTR) nathan@0: nathan@0: ### The C++ compiler and options: nathan@0: nathan@0: CXX ?= g++ nathan@8: CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual nathan@0: nathan@0: ### The directory environment: nathan@0: nathan@0: VDRDIR = ../../.. nathan@0: LIBDIR = ../../lib nathan@0: TMPDIR = /tmp nathan@0: nathan@0: ### Allow user defined options to overwrite defaults: nathan@0: nathan@0: -include $(VDRDIR)/Make.config nathan@20: -include Make.config nathan@0: nathan@0: ### The version number of VDR (taken from VDR's "config.h"): nathan@0: nathan@20: VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) nathan@20: APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) nathan@10: ifeq ($(strip $(APIVERSION)),) nathan@10: APIVERSION = $(VDRVERSION) nathan@10: endif nathan@0: nathan@0: ### The name of the distribution archive: nathan@0: nathan@21: ARCHIVE = $(PLUGIN)-$(RELEASE) nathan@0: PACKAGE = vdr-$(ARCHIVE) nathan@0: nathan@0: ### Includes and Defines (add further entries here): nathan@0: nathan@10: INCLUDES += -I$(VDRDIR)/include nathan@0: nathan@0: DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' nathan@0: nathan@0: ### The object files (add further files here): nathan@0: nathan@20: OBJS = $(PLUGIN).o version.o nathan@0: nathan@2: ifdef DBG nathan@2: CXXFLAGS += -g nathan@2: endif nathan@2: nathan@14: ### Internationalization (I18N): nathan@0: nathan@14: PODIR = po nathan@14: I18Npot = $(PODIR)/$(PLUGIN).pot nathan@23: I18Npots := $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))) nathan@23: ifeq ($(strip $(APIVERSION)),1.5.7) nathan@23: I18Nmo = $(PLUGIN).mo nathan@23: else nathan@23: I18Nmo = vdr-$(PLUGIN).mo nathan@23: endif nathan@14: LOCALEDIR = $(VDRDIR)/locale nathan@23: I18Nmsgs := $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo),$(I18Npots))) nathan@23: nathan@23: HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h) nathan@23: ifeq ($(strip $(HASLOCALE)),) nathan@23: OBJS += i18n.o nathan@23: endif nathan@0: nathan@21: ### Targets: nathan@21: nathan@21: TARGETS = libvdr-$(PLUGIN).so nathan@23: ifneq ($(strip $(HASLOCALE)),) nathan@23: TARGETS += i18n nathan@21: endif nathan@21: nathan@21: all: $(TARGETS) nathan@23: .PHONY: i18n clean dist nathan@21: nathan@0: # Dependencies: nathan@0: nathan@0: MAKEDEP = $(CXX) -MM -MG nathan@0: DEPFILE = .dependencies nathan@23: DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c))) nathan@20: $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h) nathan@20: @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@ nathan@0: nathan@0: -include $(DEPFILE) nathan@0: nathan@21: # Rules nathan@14: nathan@14: %.o: %.c nathan@14: $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< nathan@0: nathan@0: libvdr-$(PLUGIN).so: $(OBJS) nathan@0: $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ nathan@10: @cp $@ $(LIBDIR)/$@.$(APIVERSION) nathan@0: nathan@23: $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c ) nathan@19: xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $^ nathan@14: nathan@14: %.po: $(I18Npot) nathan@19: msgmerge -U --no-wrap --no-location --backup=none -q $@ $< nathan@14: @touch $@ nathan@14: nathan@14: %.mo: %.po nathan@14: msgfmt -c -o $@ $< nathan@14: nathan@23: $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo): $(PODIR)/%.mo nathan@14: @mkdir -p $(dir $@) nathan@14: cp $< $@ nathan@14: nathan@14: i18n: $(I18Nmsgs) nathan@14: nathan@23: i18n.c: $(PODIR)/*.po i18n-template.c po2i18n.pl nathan@23: perl ./po2i18n.pl i18n.c nathan@23: nathan@20: version.c: FORCE nathan@20: @echo >$@.new "/* this file will be overwritten without warning */"; \ nathan@20: echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \ nathan@20: diff $@.new $@ >$@.diff 2>&1; \ nathan@20: if test -s $@.diff; then mv -f $@.new $@; fi; \ nathan@20: rm -f $@.new $@.diff; nathan@20: nathan@0: dist: clean nathan@0: @-rm -rf $(TMPDIR)/$(ARCHIVE) nathan@0: @mkdir $(TMPDIR)/$(ARCHIVE) nathan@0: @cp -a * $(TMPDIR)/$(ARCHIVE) nathan@4: @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE) nathan@0: @-rm -rf $(TMPDIR)/$(ARCHIVE) nathan@2: @echo Distribution package created as $(PACKAGE).tar.gz nathan@0: nathan@0: clean: nathan@2: @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~ nathan@23: @-rm -f version.c i18n.c nathan@20: @-rm -f $(PODIR)/*.mo nathan@20: nathan@20: FORCE: