diff options
author | methodus <methodus@web.de> | 2013-04-19 22:00:56 +0200 |
---|---|---|
committer | methodus <methodus@web.de> | 2013-04-19 22:00:56 +0200 |
commit | 5fa0c9d9fab6bca8a44459f1628b60ae89760ffa (patch) | |
tree | ca17f29d43c19183ef04d635e124180e90c2ef71 | |
parent | aa99a1555aed836d2a123a1880c55c99801ceacd (diff) | |
download | vdr-plugin-upnp-5fa0c9d9fab6bca8a44459f1628b60ae89760ffa.tar.gz vdr-plugin-upnp-5fa0c9d9fab6bca8a44459f1628b60ae89760ffa.tar.bz2 |
Applied makefile patch provided by Zoolooc. Thank you\!
-rw-r--r-- | Make.config | 52 | ||||
-rw-r--r-- | Makefile | 78 | ||||
-rw-r--r-- | Makefile.plugins | 30 | ||||
-rw-r--r-- | plugins/profiler/vdrDVBProfiler/Makefile | 4 | ||||
-rw-r--r-- | plugins/provider/fileProvider/Makefile | 1 | ||||
-rw-r--r-- | plugins/provider/recProvider/Makefile | 1 | ||||
-rw-r--r-- | plugins/provider/vdrProvider/Makefile | 1 |
7 files changed, 101 insertions, 66 deletions
diff --git a/Make.config b/Make.config index b8b635e..9b3507d 100644 --- a/Make.config +++ b/Make.config @@ -1,4 +1,3 @@ -# # Makefile for a Video Disk Recorder plugin # # $Id$ @@ -6,13 +5,10 @@ # 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 = upnp -### The sources root build directory as seen by the called (to be overrideable by it) +PLUGIN = upnp +# we need this one when building the subplugins ROOTBUILDDIR ?= $(shell pwd) ### The version number of this plugin (taken from the main source file): @@ -22,38 +18,44 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(ROOTBUILDDIR)/$(PLUGIN ### If you do not want to strip binaries on installing, you may comment this: #PRESTRIP = -s -### The C++ compiler and options: - -CXX ?= g++ -ECPPC ?= ecppc -CXXFLAGS ?= -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -fPIC - ### The directory environment: -VDRDIR ?= $(ROOTBUILDDIR)/../../.. -VDRINCDIR ?= $(VDRDIR) -VDRPLUGINLIBDIR ?= /usr/lib/vdr/plugins -VDRCFGDIR ?= /etc/vdr/plugins/$(PLUGIN) -VDRRESDIR ?= /usr/share/vdr/$(PLUGIN) -LIBDIR ?= $(ROOTBUILDDIR)/../../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 --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc)) +LIBDIR ?= $(call PKGCFG,libdir) +LOCDIR ?= $(call PKGCFG,locdir) +VDRCFGDIR ?= $(call PKGCFG,configdir)/plugins/$(PLUGIN) +VDRRESDIR ?= $(call PKGCFG,resdir)/plugins/$(PLUGIN) +PLGCFG = $(call PKGCFG,plgcfg) +PREFIX ?= /usr +INSDOCDIR ?= $(PREFIX)/share/doc/vdr-$(PLUGIN)-$(VERSION) + +# TMPDIR ?= /tmp -PLUGINDIR= ./PLUGINS +### The compiler options: -### The version number of VDR's plugin API (taken from VDR's "config.h"): +ECPPC ?= ecppc +export CFLAGS = $(call PKGCFG,cflags) +export CXXFLAGS = $(call PKGCFG,cxxflags) -APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) +### The version number of VDR's plugin API: -### Includes and Defines (add further entries here): +APIVERSION = $(call PKGCFG,apiversion) + +### Allow user defined options to overwrite defaults: -INCLUDES += -I$(VDRDIR)/include +-include $(PLGCFG) ifdef DEBUG DEFINES = -DDEBUG endif +### Includes and Defines (add further entries here): + +INCLUDES += + DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DEFINES += -DPLUGINDIR=\"$(VDRPLUGINLIBDIR)\" # export to subplugins makefiles: -export PRESTRIP VERSION APIVERSION INCLUDES SHAREDDEFINES SHAREDLIBS CXX CXXFLAGS VDRDIR VDRINCDIR LIBDIR TMPDIR VDRPLUGINLIBDIR +export PRESTRIP VERSION APIVERSION INCLUDES CXXFLAGS VDRDIR VDRINCDIR LIBDIR TMPDIR LOCDIR DEFINES SHAREDDEFINES SHAREDLIBS ROOTBUILDDIR PREFIX INSDOCDIR @@ -14,13 +14,10 @@ -include Make.config -### Make sure that necessary options are included: +### dummy entry to silence the vdr >= 1.7.34 Makefile about old Makefile architecture +# PKGCFG --include $(VDRDIR)/Make.global - -### Allow user defined VDR options to overwrite defaults: - --include $(VDRDIR)/Make.config +### this plugin has subplugins: SUBPLUGDIR ?= ./plugins @@ -29,6 +26,10 @@ SUBPLUGDIR ?= ./plugins ARCHIVE = $(PLUGIN)-$(VERSION) PACKAGE = vdr-$(ARCHIVE) +### The name of the shared object file: + +SOFILE = libvdr-$(PLUGIN).so + ### The object files (add further files here): TNTOBJ = httptnt/deviceDescription.o \ @@ -54,10 +55,9 @@ OBJS = $(PLUGIN).o \ LIBS += -lupnp -lcxxtools -ltntnet -ltntdb -ldl - ### The main target: -all: plugin subplugins +all: $(SOFILE) subplugins i18n ### Implicit rules: @@ -72,53 +72,65 @@ all: plugin subplugins MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile - @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) $(TNTOBJ:%.o=%.cpp) > $@ + @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) $(TNTOBJ:%.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)))))) +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): $(PLUGIN).h $(OBJS:%.o=%.cpp) $(TNTOBJ:%.o=%.cpp) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -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 $@ $< + 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) $(I18Npot) +i18n: $(I18Nmo) $(I18Npot) -### Targets: +install-i18n: $(I18Nmsgs) -plugin: libvdr-$(PLUGIN).so i18n +uninstall-i18n: + for lang in $(shell basename --multiple --suffix=.po $(shell ls po/*.po)); do rm -v $(DESTDIR)$(LOCDIR)/$$lang/LC_MESSAGES/vdr-$(PLUGIN).mo; done + +### Targets: -libvdr-$(PLUGIN).so: $(OBJS) $(TNTOBJ) +$(SOFILE): $(OBJS) $(TNTOBJ) $(CXX) $(CXXFLAGS) $(LDFLAGS) -rdynamic -shared $(OBJS) $(TNTOBJ) $(LIBS) -o $@ - @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) - -install: all - @mkdir -p $(VDRPLUGINLIBDIR) - @mkdir -p $(VDRCFGDIR) -# @mkdir -p $(VDRRESDIR) - install -m 755 -o root -g root $(PRESTRIP) $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) $(VDRPLUGINLIBDIR) - cp --remove-destination --recursive httpdocs $(VDRCFGDIR) - -uninstall: - rm --recursive $(VDRPLUGINLIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) -# rm --recursive $(VDRCFGDIR)/httpdocs + +install-lib: $(SOFILE) + install -m 755 -o root -g root $(PRESTRIP) -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION) + +install-resources: + @mkdir -p $(DESTDIR)$(VDRRESDIR) + @cp --remove-destination --recursive httpdocs $(DESTDIR)$(VDRRESDIR) + +uninstall-resources: + rm --recursive $(DESTDIR)$(VDRRESDIR) + +install: install-lib install-resources install-subplugins install-i18n install-docs + +uninstall: uninstall-resources uninstall-subplugins uninstall-docs uninstall-i18n + rm --recursive $(DESTDIR)$(LIBDIR)/$(SOFILE).$(APIVERSION) + +install-docs: + @mkdir -p $(DESTDIR)$(INSDOCDIR) + @for doc in COPYING HISTORY INSTALL README; do cp $$doc $(DESTDIR)$(INSDOCDIR); done + +uninstall-docs: + rm --recursive $(DESTDIR)$(INSDOCDIR) dist: $(I18Npo) clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/Makefile.plugins b/Makefile.plugins index 595acfc..5ccb46d 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -16,6 +16,15 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Or, point your browser to http://www.gnu.org/copyleft/gpl.html +# +# when building locally in the VDR source tree ("LCLBLD=1 make plugins"), +# we have to divert ROOTBUILDDIR for our subplugins +ifdef LCLBLD +SUBPLGDIR = $(LIBDIR) +else +SUBPLGDIR = $(ROOTBUILDDIR) +endif + ### Includes and Defines SINCLUDES += -I../../../include @@ -44,7 +53,7 @@ $(DEPFILE): $(OBJS:%.o=%.cpp) $(wildcard *.h) LIBUPNP = libupnp-$(shell echo $(TARGET) | awk '{print tolower($$0)}').so LIBUPNPVER = $(LIBUPNP).$(UPNPAPIVERSION)-$(APIVERSION) -BUILDTARGETS = $(LIBDIR)/$(LIBUPNPVER) +BUILDTARGETS = $(SUBPLGDIR)/$(LIBUPNPVER) _all: $(BUILDTARGETS) .PHONY: clean dist @@ -55,14 +64,21 @@ _all: $(BUILDTARGETS) $(LIBUPNP): $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) $(SHAREDLIBS) -o $@ -$(LIBDIR)/$(LIBUPNPVER): $(LIBUPNP) +$(SUBPLGDIR)/$(LIBUPNPVER): $(LIBUPNP) @cp -p $< $@ _clean: - @-rm -f $(OBJS) $(CLEAN_RM) $(DEPFILE) $(LIBUPNP) $(LIBDIR)/$(LIBUPNPVER) core* *~ + @-rm -f $(OBJS) $(CLEAN_RM) $(DEPFILE) $(LIBUPNP) $(SUBPLGDIR)/$(LIBUPNPVER) core* *~ + +_install: all _install-docs + install -m 755 -o root -g root $(PRESTRIP) $(SUBPLGDIR)/$(LIBUPNPVER) $(DESTDIR)$(LIBDIR) + +_uninstall: _uninstall-docs + rm $(DESTDIR)$(LIBDIR)/$(LIBUPNPVER) -_install: all - install -m 755 -o root -g root $(PRESTRIP) $(LIBDIR)/$(LIBUPNPVER) $(VDRPLUGINLIBDIR) +_install-docs: + @mkdir -p $(DESTDIR)$(INSDOCDIR) + @for doc in $(DOCS); do cp $$doc $(DESTDIR)$(INSDOCDIR)/$$doc.$(TARGET); done -_uninstall: - rm $(VDRPLUGINLIBDIR)/$(LIBUPNPVER) +_uninstall-docs: + @for doc in $(DOCS); do rm $(DESTDIR)$(INSDOCDIR)/$$doc.$(TARGET); done diff --git a/plugins/profiler/vdrDVBProfiler/Makefile b/plugins/profiler/vdrDVBProfiler/Makefile index bfc8011..a1d5c7e 100644 --- a/plugins/profiler/vdrDVBProfiler/Makefile +++ b/plugins/profiler/vdrDVBProfiler/Makefile @@ -9,6 +9,7 @@ CATEGORY = Profiler TARGET = $(SUBPLUGIN)-$(CATEGORY) OBJS = $(SUBPLUGIN)$(CATEGORY).o +DOCS = README ROOTBUILDDIR = ../../.. @@ -22,7 +23,8 @@ clean: install: @$(MAKE) -f ../../../Makefile.plugins -C "$(shell pwd)" _install - cp --remove-destination channelTitle.conf $(VDRCFGDIR) + @mkdir -p $(DESTDIR)$(VDRCFGDIR) + cp --remove-destination channelTitle.conf $(DESTDIR)$(VDRCFGDIR) uninstall: @$(MAKE) -f ../../../Makefile.plugins -C "$(shell pwd)" _uninstall diff --git a/plugins/provider/fileProvider/Makefile b/plugins/provider/fileProvider/Makefile index c16064a..4d8f213 100644 --- a/plugins/provider/fileProvider/Makefile +++ b/plugins/provider/fileProvider/Makefile @@ -9,6 +9,7 @@ CATEGORY = Provider TARGET = $(SUBPLUGIN)-$(CATEGORY) OBJS = $(SUBPLUGIN)$(CATEGORY).o +DOCS = README ROOTBUILDDIR = ../../.. diff --git a/plugins/provider/recProvider/Makefile b/plugins/provider/recProvider/Makefile index ffef840..05a7029 100644 --- a/plugins/provider/recProvider/Makefile +++ b/plugins/provider/recProvider/Makefile @@ -9,6 +9,7 @@ CATEGORY = Provider TARGET = $(SUBPLUGIN)-$(CATEGORY) OBJS = $(SUBPLUGIN)$(CATEGORY).o +DOCS = README ROOTBUILDDIR = ../../.. diff --git a/plugins/provider/vdrProvider/Makefile b/plugins/provider/vdrProvider/Makefile index 2e47793..f1fdf37 100644 --- a/plugins/provider/vdrProvider/Makefile +++ b/plugins/provider/vdrProvider/Makefile @@ -9,6 +9,7 @@ CATEGORY = Provider TARGET = $(SUBPLUGIN)-$(CATEGORY) OBJS = $(SUBPLUGIN)$(CATEGORY).o +DOCS = README ROOTBUILDDIR = ../../.. |