diff options
| author | Jochen Dolze <vdr@dolze.de> | 2010-08-01 08:42:12 +0200 |
|---|---|---|
| committer | Jochen Dolze <vdr@dolze.de> | 2010-07-31 22:32:15 +0200 |
| commit | 415f957ea35045b32b96831def310465b35035e1 (patch) | |
| tree | 571819cd67f6d0da19e8d290d65db240473da1fb /Makefile | |
| parent | 5785295a438e1ddd874f27b0f89b391d7c976fd7 (diff) | |
| download | vdr-plugin-tvonscreen-415f957ea35045b32b96831def310465b35035e1.tar.gz vdr-plugin-tvonscreen-415f957ea35045b32b96831def310465b35035e1.tar.bz2 | |
Added gettext support
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 78 |
1 files changed, 48 insertions, 30 deletions
@@ -1,30 +1,26 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile,v 1.7 2006/06/18 13:59:36 schmitzj Exp $ # 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. +# IMPORTANT: the presence of this macro is important for the Make.config +# file. So it must be defined, even if it is not used here! # PLUGIN = tvonscreen ### The version number of this plugin (taken from the main source file): -VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') - -### 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) +VERSION = $(shell grep 'static const char \*VERSION *=' $PLUGIN.cpp | awk '{ print $$6 }' | sed -e 's/[";]//g') ### The C++ compiler and options: CXX ?= g++ -CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual +CXXFLAGS ?= -fPIC -g -O2 -Wall -Wextra -Woverloaded-virtual -Wno-parentheses ### The directory environment: -DVBDIR = ../../../../DVB VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp @@ -33,9 +29,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) ### The name of the distribution archive: @@ -44,44 +40,66 @@ PACKAGE = vdr-$(ARCHIVE) ### Includes and Defines (add further entries here): -INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include +INCLUDES += -I$(VDRDIR)/include +INCLUDES += -I.. -DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -D_GNU_SOURCE +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE ### The object files (add further files here): -OBJS = $(PLUGIN).o i18n.o magazine.o anyfont.o config.o gfxtools.o timer.o search.o +OBJS = $(PLUGIN).o anyfont.o config.o gfxtools.o i18n.o magazine.o search.o timer.o + +### The main target: + +all: libvdr-$(PLUGIN).so i18n ### Implicit rules: -%.o: %.c +%.o: %.cpp $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< -# Dependencies: +### Dependencies: -MAKEDEP = g++ -MM -MG +MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile - @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@ -include $(DEPFILE) +### Internationalization (I18N): + +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) +I18Npot = $(PODIR)/$(PLUGIN).pot + +%.mo: %.po + msgfmt -c -o $@ $< + +$(I18Npot): $(wildcard *.cpp *.h) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<see README>' -o $@ $^ + +%.po: $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ + +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + @mkdir -p $(dir $@) + cp $< $@ + +.PHONY: i18n +i18n: $(I18Nmsgs) $(I18Npot) + ### Targets: -all: libvdr-$(PLUGIN).so +install: libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) - -dist: clean - @-rm -rf $(TMPDIR)/$(ARCHIVE) - @mkdir $(TMPDIR)/$(ARCHIVE) - @cp -a * $(TMPDIR)/$(ARCHIVE) - @rm -rf `find $(TMPDIR)/$(ARCHIVE) -name CVS -print` - @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE) - @-rm -rf $(TMPDIR)/$(ARCHIVE) - @echo Distribution package created as $(PACKAGE).tgz + $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@ + @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) clean: - @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~ + @-rm -f $(OBJS) $(DEPFILE) *.so *.so.* *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot |
