summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorChristian Wieninger <winni@linux-dev.(none)>2013-03-13 23:11:08 +0100
committerChristian Wieninger <winni@linux-dev.(none)>2013-03-13 23:11:08 +0100
commit9f594a48ab8ab07e1acd65b9c5641c9e26790828 (patch)
treedc56d1af541d052869739250a63356e4ce6d55a7 /Makefile
parent7a9d6f00f4a3f57fccd082102e681c910cebc28c (diff)
downloadvdr-plugin-epgsearch-9f594a48ab8ab07e1acd65b9c5641c9e26790828.tar.gz
vdr-plugin-epgsearch-9f594a48ab8ab07e1acd65b9c5641c9e26790828.tar.bz2
new Makefile style
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile170
1 files changed, 90 insertions, 80 deletions
diff --git a/Makefile b/Makefile
index a25b4aa..c5732ac 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,9 @@
#
# Christian Wieninger cwieninger at gmx.de
#
+# Adapted to the new VDR makefile environment by Copperhead,
+# refined by Stefan Hofmann
+#
### ------------
### CONFIG START
@@ -55,21 +58,25 @@ PLUGIN4 = quickepgsearch
### The version number of this plugin (taken from the main source file):
-VERSION = $(shell grep 'static const char VERSION\[\] *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
+VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
-### The C++ compiler and options:
+### The directory environment:
-CXX ?= g++
-CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses -Wno-format-y2k
+# 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)
+MANDIR = $(call PKGCFG,mandir)
+CONFDIR = $(call PKGCFG,configdir)
+#
+TMPDIR ?= /tmp
-### The directory environment:
+### The compiler options:
-#DVBDIR = ../../../../DVB
-VDRDIR = ../../..
-LIBDIR = ../../lib
-TMPDIR = /tmp
+export CFLAGS = $(call PKGCFG,cflags)
+export CXXFLAGS = $(call PKGCFG,cxxflags)
-### auto configuring modules
+### configuring modules
ifeq ($(AUTOCONFIG),1)
ifeq (exists, $(shell pkg-config libpcre && echo exists))
REGEXLIB = pcre
@@ -84,32 +91,9 @@ ifeq ($(AUTOCONFIG),1)
endif
endif
-### Make sure that necessary options are included:
--include $(VDRDIR)/Make.global
-
+### The version number of VDR's plugin API:
-### Allow user defined options to overwrite defaults:
-
--include $(VDRDIR)/Make.config
-
-ALL = libvdr-$(PLUGIN).so createcats
-ifeq ($(WITHOUT_EPGSEARCHONLY), 0)
- ALL += libvdr-$(PLUGIN2).so
-endif
-ifeq ($(WITHOUT_CONFLICTCHECKONLY), 0)
- ALL += libvdr-$(PLUGIN3).so
-endif
-ifeq ($(WITHOUT_QUICKSEARCH), 0)
- ALL += libvdr-$(PLUGIN4).so
-endif
-
-### The version number of VDR (taken from VDR's "config.h"):
-
-VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
-APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
-ifeq ($(strip $(APIVERSION)),)
- APIVERSION = $(VDRVERSION)
-endif
+APIVERSION = $(call PKGCFG,apiversion)
### The name of the distribution archive:
@@ -118,17 +102,27 @@ PACKAGE = vdr-$(ARCHIVE)
### Includes and Defines (add further entries here):
-INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
-#INCLUDES += -I$(VDRDIR)/include
+INCLUDES +=
+
+DEFINES +=
-EPGSEARCH_DEFINES += -D_GNU_SOURCE
ifneq ($(SENDMAIL),)
-EPGSEARCH_DEFINES += -DSENDMAIL='"$(SENDMAIL)"'
+DEFINES += -DSENDMAIL='"$(SENDMAIL)"'
endif
-DEFINES += $(EPGSEARCH_DEFINES)
### The object files (add further files here):
+ALL = libvdr-$(PLUGIN).so createcats
+ifeq ($(WITHOUT_EPGSEARCHONLY), 0)
+ ALL += libvdr-$(PLUGIN2).so
+endif
+ifeq ($(WITHOUT_CONFLICTCHECKONLY), 0)
+ ALL += libvdr-$(PLUGIN3).so
+endif
+ifeq ($(WITHOUT_QUICKSEARCH), 0)
+ ALL += libvdr-$(PLUGIN4).so
+endif
+
OBJS = afuzzy.o blacklist.o changrp.o confdloader.o conflictcheck.o conflictcheck_thread.o distance.o $(PLUGIN).o epgsearchcats.o epgsearchcfg.o epgsearchext.o epgsearchsetup.o epgsearchsvdrp.o epgsearchtools.o mail.o md5.o menu_announcelist.o menu_blacklistedit.o menu_blacklists.o menu_commands.o menu_conflictcheck.o menu_deftimercheckmethod.o menu_dirselect.o menu_event.o menu_favorites.o menu_main.o menu_myedittimer.o menu_quicksearch.o menu_recsdone.o menu_search.o menu_searchactions.o menu_searchedit.o menu_searchresults.o menu_searchtemplate.o menu_switchtimers.o menu_templateedit.o menu_timersdone.o menu_whatson.o noannounce.o pending_notifications.o rcfile.o recdone.o recstatus.o searchtimer_thread.o services.o switchtimer.o switchtimer_thread.o templatefile.o timer_thread.o timerdone.o timerstatus.o uservars.o varparser.o
ifeq ($(REGEXLIB), pcre)
@@ -165,7 +159,7 @@ endif
### length of the filling '-' in the channel separators, defaults to
### "----------------------------------------"
-### overwrite this with PLUGIN_EPGSEARCH_SEP_ITEMS=--- in your Make.config
+### overwrite this with PLUGIN_EPGSEARCH_SEP_ITEMS=---
### to avoid problems with graphlcd
ifdef PLUGIN_EPGSEARCH_SEP_ITEMS
DEFINES += -DMENU_SEPARATOR_ITEMS='"$(PLUGIN_EPGSEARCH_SEP_ITEMS)"'
@@ -182,20 +176,20 @@ LIBS4 =
### The main target:
-all: $(ALL) i18n
+all: $(ALL) i18n docs
### Implicit rules:
%.o: %.c
- $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN)"' $(INCLUDES) $<
+ $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN)"' $(INCLUDES) -o $@ $<
mainmenushortcut.o: mainmenushortcut.c
- $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(MAINMENUSHORTCUT)"' $(INCLUDES) $<
+ $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(MAINMENUSHORTCUT)"' $(INCLUDES) -o $@ $<
epgsearchonly.o: epgsearchonly.c
- $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN2)"' $(INCLUDES) $<
+ $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN2)"' $(INCLUDES) -o $@ $<
conflictcheckonly.o: conflictcheckonly.c
- $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN3)"' $(INCLUDES) $<
+ $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN3)"' $(INCLUDES) -o $@ $<
quickepgsearch.o: quickepgsearch.c
- $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN4)"' $(INCLUDES) $<
+ $(CXX) $(CXXFLAGS) -c $(DEFINES) -DPLUGIN_NAME_I18N='"$(PLUGIN4)"' $(INCLUDES) -o $@ $<
# Dependencies:
@@ -209,49 +203,85 @@ $(DEPFILE): Makefile
### 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 *.[ch])
- xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP -kI18nTranslate --msgid-bugs-address='<cwieninger@gmx.de>' -o $@ `ls $^`
+$(I18Npot): $(wildcard *.c)
+ 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)
+
+install-i18n: $(I18Nmsgs)
### Targets:
libvdr-$(PLUGIN).so: $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
libvdr-$(PLUGIN2).so: $(OBJS2)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS2) $(LIBS2) -o $@
- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
libvdr-$(PLUGIN3).so: $(OBJS3)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS3) $(LIBS3) -o $@
- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
libvdr-$(PLUGIN4).so: $(OBJS4)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS4) $(LIBS4) -o $@
- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
createcats: createcats.o Makefile
$(CXX) $(CXXFLAGS) $(LDFLAGS) createcats.o -o $@
+docs:
+ ./docsrc2man.sh
+ ./docsrc2html.sh
+ ln -sf ./doc/en/epgsearch.4.txt MANUAL
+ ln -sf ./doc/en/epgsearch.1.txt README
+ ln -sf ./doc/de/epgsearch.1.txt README.DE
+
+install-$(PLUGIN): libvdr-$(PLUGIN).so
+ install -D libvdr-$(PLUGIN).so $(DESTDIR)$(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION)
+
+install-$(PLUGIN2): libvdr-$(PLUGIN2).so
+ install -D libvdr-$(PLUGIN2).so $(DESTDIR)$(LIBDIR)/libvdr-$(PLUGIN2).so.$(APIVERSION)
+
+install-$(PLUGIN3): libvdr-$(PLUGIN3).so
+ install -D libvdr-$(PLUGIN3).so $(DESTDIR)$(LIBDIR)/libvdr-$(PLUGIN3).so.$(APIVERSION)
+
+install-$(PLUGIN4): libvdr-$(PLUGIN4).so
+ install -D libvdr-$(PLUGIN4).so $(DESTDIR)$(LIBDIR)/libvdr-$(PLUGIN4).so.$(APIVERSION)
+
+install-conf:
+ mkdir -p $(DESTDIR)$(CONFDIR)/plugins/$(PLUGIN)
+ cp -n conf/* $(DESTDIR)$(CONFDIR)/plugins/$(PLUGIN)
+
+install-doc:
+ mkdir -p $(DESTDIR)$(MANDIR)/man1
+ mkdir -p $(DESTDIR)$(MANDIR)/man4
+ mkdir -p $(DESTDIR)$(MANDIR)/man5
+ mkdir -p $(DESTDIR)$(MANDIR)/de/man1
+ mkdir -p $(DESTDIR)$(MANDIR)/de/man5
+ cp man/en/*1.gz $(DESTDIR)$(MANDIR)/man1/
+ cp man/en/*4.gz $(DESTDIR)$(MANDIR)/man4/
+ cp man/en/*5.gz $(DESTDIR)$(MANDIR)/man5/
+ cp man/de/*1.gz $(DESTDIR)$(MANDIR)/de/man1/
+ cp man/de/*5.gz $(DESTDIR)$(MANDIR)/de/man5/
+
+install: install-lib install-i18n install-conf install-doc
+
+install-lib: install-$(PLUGIN) install-$(PLUGIN2) install-$(PLUGIN3) install-$(PLUGIN4)
+
dist: docs clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@@ -274,26 +304,6 @@ distfull: docs clean
@ln -sf README.git README
@echo complete distribution package created as $(PACKAGE).tgz
-docs:
- @./docsrc2man.sh
- @./docsrc2html.sh
- @ln -sf ./doc/en/epgsearch.4.txt MANUAL
- @ln -sf ./doc/en/epgsearch.1.txt README
- @ln -sf ./doc/de/epgsearch.1.txt README.DE
-
-install-doc: docs
- @mkdir -p $(MANDIR)/man1
- @mkdir -p $(MANDIR)/man4
- @mkdir -p $(MANDIR)/man5
- @mkdir -p $(MANDIR)/de/man1
- @mkdir -p $(MANDIR)/de/man5
-
- @cp man/en/*1.gz $(MANDIR)/man1/
- @cp man/en/*4.gz $(MANDIR)/man4/
- @cp man/en/*5.gz $(MANDIR)/man5/
- @cp man/de/*1.gz $(MANDIR)/de/man1/
- @cp man/de/*5.gz $(MANDIR)/de/man5/
-
clean:
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
@-rm -f $(OBJS) $(OBJS2) $(OBJS3) $(OBJS4) $(DEPFILE) *.so *.tgz core* createcats createcats.o pod2*.tmp