2 # PremiereEpg plugin to VDR
4 # (C) 2005-2008 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 # The official name of this plugin.
22 # This name will be used in the '-P...' option of VDR to load the plugin.
23 # By default the main source file also carries this name.
27 ### The version number of this plugin:
29 HGARCHIVE = .hg_archival.txt
30 RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
31 RELSTR := $(shell if test -d .hg; then \
32 echo -n "-"; (hg identify 2>/dev/null || echo -n "Unknown") | sed -e 's/ .*//'; \
33 elif test -r $(HGARCHIVE); then \
34 echo -n "-"; grep "^node" $(HGARCHIVE) | awk '{ printf "%.12s",$$2 }'; \
36 VERSION := $(RELEASE)$(RELSTR)
38 ### The C++ compiler and options:
41 CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual
43 ### The directory environment:
49 ### Allow user defined options to overwrite defaults:
51 -include $(VDRDIR)/Make.config
54 ### The version number of VDR (taken from VDR's "config.h"):
56 VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
57 APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
58 ifeq ($(strip $(APIVERSION)),)
59 APIVERSION = $(VDRVERSION)
62 ### The name of the distribution archive:
64 ARCHIVE = $(PLUGIN)-$(RELEASE)
65 PACKAGE = vdr-$(ARCHIVE)
67 ### Includes and Defines (add further entries here):
69 INCLUDES += -I$(VDRDIR)/include
71 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
73 ### The object files (add further files here):
75 OBJS = $(PLUGIN).o version.o
81 ### Internationalization (I18N):
84 I18Npot = $(PODIR)/$(PLUGIN).pot
85 I18Npots := $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))
86 ifeq ($(strip $(APIVERSION)),1.5.7)
89 I18Nmo = vdr-$(PLUGIN).mo
91 LOCALEDIR = $(VDRDIR)/locale
92 I18Nmsgs := $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo),$(I18Npots)))
94 HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h)
95 ifeq ($(strip $(HASLOCALE)),)
101 TARGETS = libvdr-$(PLUGIN).so
102 ifneq ($(strip $(HASLOCALE)),)
107 .PHONY: i18n clean dist
111 MAKEDEP = $(CXX) -MM -MG
112 DEPFILE = .dependencies
113 DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c)))
114 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
115 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
122 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
124 libvdr-$(PLUGIN).so: $(OBJS)
125 $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
126 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
128 $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c )
129 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^
132 msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
138 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo): $(PODIR)/%.mo
144 i18n.c: $(PODIR)/*.po i18n-template.c po2i18n.pl
145 perl ./po2i18n.pl <i18n-template.c >i18n.c
148 @echo >$@.new "/* this file will be overwritten without warning */"; \
149 echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \
150 diff $@.new $@ >$@.diff 2>&1; \
151 if test -s $@.diff; then mv -f $@.new $@; fi; \
152 rm -f $@.new $@.diff;
155 @-rm -rf $(TMPDIR)/$(ARCHIVE)
156 @mkdir $(TMPDIR)/$(ARCHIVE)
157 @cp -a * $(TMPDIR)/$(ARCHIVE)
158 @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
159 @-rm -rf $(TMPDIR)/$(ARCHIVE)
160 @echo Distribution package created as $(PACKAGE).tar.gz
163 @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~
164 @-rm -f version.c i18n.c
165 @-rm -f $(PODIR)/*.mo