diff options
author | Martin Dummer <martin.dummer@gmx.net> | 2014-06-08 12:27:23 +0200 |
---|---|---|
committer | Martin Dummer <martin.dummer@gmx.net> | 2014-06-08 12:27:23 +0200 |
commit | a60180326c4a684c8efb46edf15dd5b01f7fda32 (patch) | |
tree | 0b45d694bf89da21fab29e43eda59ce26391f33e | |
parent | d87532e584a366bd31ee43452b092d91ee5ed619 (diff) | |
download | vdr-plugin-undelete-a60180326c4a684c8efb46edf15dd5b01f7fda32.tar.gz vdr-plugin-undelete-a60180326c4a684c8efb46edf15dd5b01f7fda32.tar.bz2 |
Makefile: new Makefile taken from vdr-2.1.6
and small edit in undelete.c to make version number grep in
new Makefile work again
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | Makefile | 82 | ||||
-rw-r--r-- | undelete.c | 6 |
3 files changed, 52 insertions, 39 deletions
@@ -7,6 +7,9 @@ VDR Plugin 'undelete' Revision History - new minimum vdr version 1.5.7, added code to ensure this - add version requirements to README - start code cleanup: remove conditional code for vdr <1.5.7 +- insert compile fix for vdr >=2.1.2, thx to hd_brummy + closes ticket #1858 http://projects.vdr-developer.org/issues/1858 +- new Makefile taken from vdr-2.1.6 2012-10-05 Version: 0.0.7 ------------------------- @@ -1,14 +1,12 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id$ +# $Id: Makefile 3.1 2014/01/01 13:29:54 kls 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 = undelete ### The version number of this plugin (taken from the main source file): @@ -16,40 +14,43 @@ PLUGIN = undelete VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') GITTAG = $(shell git describe --always 2>/dev/null) -### The C++ compiler and options: - -CXX ?= g++ -CXXFLAGS ?= -fPIC -O2 -Wall -Woverloaded-virtual - ### The directory environment: -VDRDIR ?= ../../.. -LIBDIR ?= ../../lib +# 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_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr)) +LIBDIR = $(call PKGCFG,libdir) +LOCDIR = $(call PKGCFG,locdir) +PLGCFG = $(call PKGCFG,plgcfg) +# TMPDIR ?= /tmp -### Make sure that necessary options are included: +### The compiler options: --include $(VDRDIR)/Make.global +export CFLAGS = $(call PKGCFG,cflags) +export CXXFLAGS = $(call PKGCFG,cxxflags) -### Allow user defined options to overwrite defaults: +### The version number of VDR's plugin API: --include $(VDRDIR)/Make.config +APIVERSION = $(call PKGCFG,apiversion) -### The version number of VDR's plugin API (taken from VDR's "config.h"): +### Allow user defined options to overwrite defaults: -VDRVERSNUM = $(shell grep 'define VDRVERSNUM ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') -APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) +-include $(PLGCFG) ### 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 +INCLUDES += -DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ### Test SVDRP ifeq ($(shell grep -q ReplyCode $(VDRDIR)/plugin.h ; echo $$?),0) @@ -76,57 +77,64 @@ endif OBJS = $(PLUGIN).o menuundelete.o menusetup.o vdrtools.o menueditkeys.o menudispkey.o ifneq ($(strip $(GITTAG)),) -DEFINES += -DGITVERSION='"-GIT-$(GITTAG)"' + DEFINES += -DGITVERSION='"-GIT-$(GITTAG)"' endif +### The main target: + +all: $(SOFILE) i18n + ### Implicit rules: %.o: %.c - $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< ### Dependencies: MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile - @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ + @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ -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)))))) +I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) +I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) I18Npot = $(PODIR)/$(PLUGIN).pot %.mo: %.po msgfmt -c -o $@ $< $(I18Npot): $(wildcard *.c) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<martin.dummer@gmx.net>' -o $@ $^ + 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 $@ $< + msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $< @touch $@ -$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo - @mkdir -p $(dir $@) - cp $< $@ +$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + install -D -m644 $< $@ .PHONY: i18n -i18n: $(I18Nmsgs) +i18n: $(I18Nmo) $(I18Npot) -### Targets: +install-i18n: $(I18Nmsgs) -all: libvdr-$(PLUGIN).so i18n +### Targets: -libvdr-$(PLUGIN).so: $(OBJS) +$(SOFILE): $(OBJS) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@ - @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) -dist: clean +install-lib: $(SOFILE) + install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION) + +install: install-lib install-i18n + +dist: $(I18Npo) clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) @@ -136,4 +144,4 @@ dist: clean clean: @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot - @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ *.bak + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ @@ -19,12 +19,14 @@ #error "VDR-1.5.7 API version or greater is required!" #endif +#error APIVERSION + #ifndef GITVERSION #define GITVERSION "" #endif -static const char VERSION[] = "0.0.7" GITVERSION; -static const char DESCRIPTION[] = trNOOP("undelete for recordings"); +static const char *VERSION = "0.0.7" GITVERSION; +static const char *DESCRIPTION = trNOOP("undelete for recordings"); // Global variables that control the overall behaviour: |