summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorthlo <smarttv640@gmail.com>2014-04-25 16:58:07 +0200
committerthlo <smarttv640@gmail.com>2014-04-25 16:58:07 +0200
commit6ee39aef2622c86e9d30dcc5371a5efd981f7f92 (patch)
tree75c4ac0acf1a95e551f4cbcd8065a586d1cf281e /Makefile
parentc35351510ccd0e99ac6cc8a0bb9384d24acc5571 (diff)
downloadvdr-plugin-smarttvweb-6ee39aef2622c86e9d30dcc5371a5efd981f7f92.tar.gz
vdr-plugin-smarttvweb-6ee39aef2622c86e9d30dcc5371a5efd981f7f92.tar.bz2
Moved default to new Makefile.
Diffstat (limited to 'Makefile')
-rwxr-xr-x[-rw-r--r--]Makefile111
1 files changed, 63 insertions, 48 deletions
diff --git a/Makefile b/Makefile
index 61673f5..3c007f9 100644..100755
--- a/Makefile
+++ b/Makefile
@@ -1,100 +1,115 @@
#
# Makefile for a Video Disk Recorder plugin
#
-#
+# $Id: Makefile 2.18 2013/01/12 13:45:01 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.
-#
+
PLUGIN = smarttvweb
### 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')
-### The C++ compiler and options:
-
-
-CXX ?= g++
-#ifdef DEBUG
-CXXFLAGS ?= -g -O0 -fPIC -Wall -Woverloaded-virtual #-Werror
-#else
-#CXXFLAGS ?= -fPIC -Wall -Woverloaded-virtual #-Werror
-#CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual #-Werror
-#endif
-
### 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)
+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)
-### read standlone settings if there
--include .standalone
+### The version number of VDR's plugin API:
-### The version number of VDR (taken from VDR's "config.h"):
+APIVERSION = $(call PKGCFG,apiversion)
-VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
-APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
+### Allow user defined options to overwrite defaults:
+
+-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$(DVBDIR)/include
+INCLUDES +=
-DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):
OBJS = $(PLUGIN).o smarttvfactory.o httpresource.o httpclient.o mngurls.o log.o url.o stvw_cfg.o responsebase.o responsefile.o responsevdrdir.o responsememblk.o responselive.o httpresource_base.o
-OBJS2 =
+### The main target:
+
+all: $(SOFILE) i18n
### Implicit rules:
%.o: %.c
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
-# Dependencies:
+### Dependencies:
-MAKEDEP = g++ -MM -MG
+MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
- @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+ @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
-include $(DEPFILE)
-### Targets:
+### Internationalization (I18N):
-all: allbase libvdr-$(PLUGIN).so
-standalone: standalonebase smarttvweb-standalone
+PODIR = po
+I18Npo = $(wildcard $(PODIR)/*.po)
+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
-objectsstandalone: $(OBJS)
-objects: $(OBJS) $(OBJS2)
+%.mo: %.po
+ msgfmt -c -o $@ $<
-allbase:
- ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
-standalonebase:
- ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
+$(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 $^`
-libvdr-$(PLUGIN).so: objects
- $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
- @cp $@ $(LIBDIR)/$@.$(APIVERSION)
+%.po: $(I18Npot)
+ msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
+ @touch $@
-smarttvweb-standalone: objectsstandalone
- $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
- chmod u+x $@
+$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
+ install -D -m644 $< $@
-dist: clean
+.PHONY: i18n
+i18n: $(I18Nmo) $(I18Npot)
+
+install-i18n: $(I18Nmsgs)
+
+### Targets:
+
+$(SOFILE): $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
+
+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)
@@ -103,5 +118,5 @@ dist: clean
@echo Distribution package created as $(PACKAGE).tgz
clean:
- rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so.* *.tgz core* *~ .standalone smarttvweb-standalone
-
+ @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
+ @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~