diff options
author | lado <herrlado@gmail.com> | 2012-12-28 14:11:06 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2012-12-28 14:11:06 +0100 |
commit | ec078ce9b1551947e52e5f0818c42f4a32c36da8 (patch) | |
tree | 2ece7a9e3c15c8cc7013a31741ee089db649d322 | |
parent | 7a574b06da97691aaa42db47f421619e32ed2279 (diff) | |
download | vdr-manager-ec078ce9b1551947e52e5f0818c42f4a32c36da8.tar.gz vdr-manager-ec078ce9b1551947e52e5f0818c42f4a32c36da8.tar.bz2 |
http://projects.vdr-developer.org/issues/1197
-rw-r--r-- | vdr-vdrmanager/Makefile | 89 |
1 files changed, 62 insertions, 27 deletions
diff --git a/vdr-vdrmanager/Makefile b/vdr-vdrmanager/Makefile index 90941fb..174dedd 100644 --- a/vdr-vdrmanager/Makefile +++ b/vdr-vdrmanager/Makefile @@ -1,59 +1,65 @@ # -# Makefile for a Video Disk Recorder plugin +# Makefile for a Video Disk Recorder plugin vdrmanager # -# $Id$ +# $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 = vdrmanager ### The version number of this plugin (taken from the main source file): -VERSION = $(shell grep 'const char \*VERSION *=' $(PLUGIN).cpp | awk '{ print $$5 }' | sed -e 's/[";]//g') - -### The C++ compiler and options: - -CXX ?= g++ -CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual -fPIC -g +VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).cpp | awk '{ print $$6 }' | sed -e 's/[";]//g') ### The directory environment: -DVBDIR = ../../../../DVB -VDRDIR = ../../.. -LIBDIR = ../../lib -TMPDIR = /tmp +# Use package data if installed...otherwise assume we're under the VDR source directory: +PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc)) +LIBDIR = $(DESTDIR)$(call PKGCFG,libdir) +LOCDIR = $(DESTDIR)$(call PKGCFG,locdir) +# +TMPDIR ?= /tmp -### Allow user defined options to overwrite defaults: +### The compiler options: --include $(VDRDIR)/Make.config +export CFLAGS = $(call PKGCFG,cflags) +export CXXFLAGS = $(call PKGCFG,cxxflags) -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API: -APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(call PKGCFG,apiversion) ### The name of the distribution archive: ARCHIVE = $(PLUGIN)-$(VERSION) PACKAGE = vdr-$(ARCHIVE) +### The name of the shared object file: + +SOFILE = libvdr-$(PLUGIN).so + ### Includes and Defines (add further entries here): -INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include +INCLUDES += -DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ### The object files (add further files here): -OBJS = $(PLUGIN).o sock.o vdrmanagerthread.o select.o handler.o helpers.o +OBJS = $(PLUGIN).o + +### The main target: + +all: $(SOFILE) i18n ### Implicit rules: %.o: %.cpp - $(CXX) -g $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< -# Dependencies: +### Dependencies: MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies @@ -62,15 +68,43 @@ $(DEPFILE): Makefile -include $(DEPFILE) +### Internationalization (I18N): + +PODIR = po +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) +I18Nmsgs = $(addprefix $(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) +I18Npot = $(PODIR)/$(PLUGIN).pot + +%.mo: %.po + msgfmt -c -o $@ $< + +$(I18Npot): $(wildcard *.cpp) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^` + +%.po: $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $< + @touch $@ + +$(I18Nmsgs): $(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + install -D -m644 $< $@ + +.PHONY: i18n +i18n: $(I18Nmo) $(I18Npot) + +install-i18n: $(I18Nmsgs) + ### Targets: -all: libvdr-$(PLUGIN).so +$(SOFILE): $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@ + +install-lib: $(SOFILE) + install -D $^ $(LIBDIR)/$^.$(APIVERSION) -libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) -g $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) +install: install-lib install-i18n -dist: clean +dist: $(I18Npo) clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) @@ -79,4 +113,5 @@ dist: clean @echo Distribution package created as $(PACKAGE).tgz clean: + @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ |