diff options
| author | anbr <vdr07@deltab.de> | 2013-02-12 19:15:00 +0100 |
|---|---|---|
| committer | anbr <vdr07@deltab.de> | 2013-02-12 19:15:00 +0100 |
| commit | ab902d3962df5dbe8c8d707da96cdf279ca3b439 (patch) | |
| tree | 1bbb74443b1790665e971f4cd1a90a61933ef91a /Makefile | |
| parent | c92ba1c907240415fd7caab5b757bbdeb73efc17 (diff) | |
| download | vdr-plugin-image-ab902d3962df5dbe8c8d707da96cdf279ca3b439.tar.gz vdr-plugin-image-ab902d3962df5dbe8c8d707da96cdf279ca3b439.tar.bz2 | |
Patch for compiling with VDR 1.7.36, thanks to Ulrich Eckhardt, for summit a patch (Closes: #1251)
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 170 |
1 files changed, 92 insertions, 78 deletions
@@ -2,6 +2,7 @@ # Makefile for Image plugin to VDR # # (C) 2004-2011 Andreas Brachold <vdr07 at deltab.de> +# 2013 Ulrich Eckhardt # # This code is distributed under the terms and conditions of the # GNU GENERAL PUBLIC LICENSE. See the file COPYING for details. @@ -10,8 +11,6 @@ # You can change the compile options here or create a Make.config # in the VDR directory an set them there. # -# $Id$ -# ### uncomment the following line, if you don't have libexif installed @@ -26,43 +25,49 @@ # PLUGIN = image -### The C++ compiler and options: - -CXX ?= g++ -CXXFLAGS ?= -fPIC -O2 -Wall -Woverloaded-virtual -PKG-CONFIG ?= pkg-config +#### The version number of this plugin (taken from the main source file): -############################################### -############################################### -# -# no user configurable options below this point -# -############################################### -############################################### +VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') ### The directory environment: -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 = $(call PKGCFG,libdir) +LOCDIR = $(call PKGCFG,locdir) +CFGDIR = $(call PKGCFG,configdir)/plugins/$(PLUGIN) +PLGCFG = $(call PKGCFG,plgcfg) +# +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 this plugin (taken from the main source file): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') +APIVERSION = $(call PKGCFG,apiversion) -### The version number of VDR (taken from VDR's "config.h"): +### Allow user defined options to overwrite defaults: -APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +-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 -I. +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +CXXFLAGS +=-D__STDC_CONSTANT_MACROS + ### The version number of ffmpeg (taken from "libavcodec/avcodec.h" ): ifdef FFMDIR @@ -72,46 +77,50 @@ endif ### Includes and Defines (add further entries here): - -DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DEFINES += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS LIBS += liboutput/liboutput.a libimage/libimage.a -INCLUDES += -I$(VDRDIR)/include -I. - -ifdef FFMDIR -DEFINES += -DFFMDIR -LIBS += -L$(FFMDIR)/libavcodec -lavcodec -lz -ifeq ($(LIBAVCODECVERSION),51) -LIBS += -L$(FFMDIR)/libavformat -L$(FFMDIR)/libavutil -LIBS += -lavformat -lavutil +ifneq (exists, $(shell pkg-config libavcodec && echo exists)) + $(warning ******************************************************************) + $(warning 'libavcodec' not detected! ') + $(warning ******************************************************************) endif -ifndef WITHOUT_SWSCALER - DEFINES += -DHAVE_SWSCALER - LIBS += -L$(FFMDIR)/libswscale -lswscale -endif -else - PKG-LIBS += libavcodec - PKG-INCLUDES += libavcodec -ifndef WITHOUT_SWSCALER - PKG-INCLUDES += libswscale - PKG-LIBS += libswscale + +ifneq (exists, $(shell pkg-config libavformat && echo exists)) + $(warning ******************************************************************) + $(warning 'libavformat' not detected! ') + $(warning ******************************************************************) endif + +ifneq (exists, $(shell pkg-config libswscale && echo exists)) + $(warning ******************************************************************) + $(warning 'libswscale' not detected! ') + $(warning ******************************************************************) + WITHOUT_SWSCALER = 1 endif -ifndef WITHOUT_LIBEXIF - PKG-INCLUDES += libexif - PKG-LIBS += libexif - DEFINES += -DHAVE_LIBEXIF +ifneq (exists, $(shell pkg-config libexif && echo exists)) + $(warning ******************************************************************) + $(warning 'libexif' not detected! ') + $(warning ******************************************************************) + WITHOUT_LIBEXIF=1 endif +LIBS += $(shell pkg-config --libs libavformat) +CXXFLAGS += $(shell pkg-config --cflags libavformat) + +LIBS += $(shell pkg-config --libs libavcodec) +CXXFLAGS += $(shell pkg-config --cflags libavcodec) -ifdef PKG-INCLUDES -INCLUDES += $(shell $(PKG-CONFIG) --cflags $(PKG-INCLUDES)) +ifndef WITHOUT_SWSCALER + DEFINES += -DHAVE_SWSCALER + LIBS += $(shell pkg-config --libs libswscale) + CXXFLAGS += $(shell pkg-config --cflags libswscale) endif -ifdef PKG-LIBS -LIBS += $(shell $(PKG-CONFIG) --libs $(PKG-LIBS)) +ifndef WITHOUT_LIBEXIF + CXXFLAGS += $(shell pkg-config --cflags libexif) + LIBS += $(shell pkg-config --libs libexif) + DEFINES += -DHAVE_LIBEXIF endif ### The object files (add further files here): @@ -129,54 +138,59 @@ endif SUBDIRS = liboutput libimage +### The main target: + +all: subdirs $(SOFILE) i18n + ### Implicit rules: %.o: %.c - $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< - -# Dependencies: + $(CXX) $(CXXFLAGS) $(CEXTRA) -c $(DEFINES) $(INCLUDES) $< + +### Dependencies: MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile - @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) *.h > $@ -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 $@ $< + msgfmt -v -c -o $@ $< -$(I18Npot): $(wildcard *.c) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='Andreas Brachold <vdr07 at deltab.de>' -o $@ $^ +$(I18Npot): $(wildcard *.c *.h) + 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) + +install-i18n: $(I18Nmsgs) ### Targets: -all: subdirs libvdr-$(PLUGIN).so i18n +$(SOFILE): $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@ -libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) $(CXXFLAGS) -shared -export-dynamic $(OBJS) $(LIBS) -o $@ - @mkdir -p $(LIBDIR) - @cp $@ $(LIBDIR)/$@.$(APIVERSION) +install-lib: $(SOFILE) + install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION) +install: install-lib install-i18n subdirs: @for i in $(SUBDIRS) ;\ @@ -187,17 +201,17 @@ subdirs: || exit 1;\ done -dist: clean +dist: $(I18Npo) clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) - @chmod 644 -R $(TMPDIR)/$(ARCHIVE)/* - @find $(TMPDIR)/$(ARCHIVE) -name "*.sh" -exec chmod a+x {} \; - @find $(TMPDIR)/$(ARCHIVE) -type d -exec chmod 755 {} \; + @-rm -rf $(TMPDIR)/$(ARCHIVE)/.git + @-rm -f $(TMPDIR)/$(ARCHIVE)/.gitignore @chown root.root -R $(TMPDIR)/$(ARCHIVE)/* - @tar czf $(PACKAGE).tar.gz --exclude=.svn -C $(TMPDIR) $(ARCHIVE) + @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) - @echo Distribution package created as $(PACKAGE).tar.gz + @echo Distribution package created as $(PACKAGE).tgz + subdirs-clean: @for i in $(SUBDIRS) ;\ @@ -210,4 +224,4 @@ subdirs-clean: clean: subdirs-clean @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot - @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~ contrib/*~ examples/*~ scripts/*~ + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ contrib/*~ examples/*~ scripts/*~ |
