Plugin Makefiles now use DESTDIR and the 'install' program

This commit is contained in:
Klaus Schmidinger
2012-12-22 12:08:31 +01:00
parent 4e87443a2d
commit 0263c82614
15 changed files with 81 additions and 93 deletions

View File

@@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 2.7 2012/12/20 13:35:20 kls Exp $
# $Id: Makefile 2.8 2012/12/22 11:51:55 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
@@ -18,15 +18,14 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN1).c | awk '{ pr
# 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)
LIBDIR ?= $(DESTDIR)$(call PKGCFG,libdir)
#
TMPDIR ?= /tmp
### The compiler options:
export CFLAGS ?= $(call PKGCFG,cflags)
export CXXFLAGS ?= $(call PKGCFG,cxxflags)
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
### The version number of VDR's plugin API:
@@ -74,9 +73,8 @@ libvdr-$(PLUGIN2).so: $(PLUGIN2).o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGIN2).o -o $@
install: libvdr-$(PLUGIN1).so libvdr-$(PLUGIN2).so
@mkdir -p $(LIBDIR)
@cp --remove-destination libvdr-$(PLUGIN1).so $(LIBDIR)/libvdr-$(PLUGIN1).so.$(APIVERSION)
@cp --remove-destination libvdr-$(PLUGIN2).so $(LIBDIR)/libvdr-$(PLUGIN2).so.$(APIVERSION)
install -D libvdr-$(PLUGIN1).so $(LIBDIR)/libvdr-$(PLUGIN1).so.$(APIVERSION)
install -D libvdr-$(PLUGIN2).so $(LIBDIR)/libvdr-$(PLUGIN2).so.$(APIVERSION)
dist: clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)