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 I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))))
86 LOCALEDIR = $(VDRDIR)/locale
90 TARGETS = libvdr-$(PLUGIN).so
91 ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
100 MAKEDEP = $(CXX) -MM -MG
101 DEPFILE = .dependencies
102 DEPFILES = $(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c))
103 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
104 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
111 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
113 libvdr-$(PLUGIN).so: $(OBJS)
114 $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
115 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
117 $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR))
118 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^
121 msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
127 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
134 @echo >$@.new "/* this file will be overwritten without warning */"; \
135 echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \
136 diff $@.new $@ >$@.diff 2>&1; \
137 if test -s $@.diff; then mv -f $@.new $@; fi; \
138 rm -f $@.new $@.diff;
141 @-rm -rf $(TMPDIR)/$(ARCHIVE)
142 @mkdir $(TMPDIR)/$(ARCHIVE)
143 @cp -a * $(TMPDIR)/$(ARCHIVE)
144 @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
145 @-rm -rf $(TMPDIR)/$(ARCHIVE)
146 @echo Distribution package created as $(PACKAGE).tar.gz
149 @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~
151 @-rm -f $(PODIR)/*.mo