diff options
author | Dimitar Petrovski <dimeptr@gmail.com> | 2013-01-03 10:08:14 +0100 |
---|---|---|
committer | Dimitar Petrovski <dimeptr@gmail.com> | 2013-01-03 10:08:14 +0100 |
commit | 27f9ad3da60c42a1b982929986d9f20eae9d0049 (patch) | |
tree | 3265329455b70c78450b9f535b57c0c7450e9967 | |
parent | c0c90a946c0f5a6722f312e7156ba01c9e743d56 (diff) | |
download | vdr-plugin-eepg-27f9ad3da60c42a1b982929986d9f20eae9d0049.tar.gz vdr-plugin-eepg-27f9ad3da60c42a1b982929986d9f20eae9d0049.tar.bz2 |
modified Makefile according to the new VDR version 1.7.35 style
-rw-r--r-- | Makefile | 112 | ||||
-rw-r--r-- | eepg.c | 2 |
2 files changed, 58 insertions, 56 deletions
@@ -28,58 +28,57 @@ PLUGIN = eepg 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 ?= -O2 -fPIC -Wall -Woverloaded-virtual +# 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 = $(DESTDIR)$(call PKGCFG,libdir) +LOCDIR = $(DESTDIR)$(call PKGCFG,locdir) +PLGCFG = $(call PKGCFG,plgcfg) +# +TMPDIR ?= /tmp -### The directory environment: +### The compiler options: -VDRDIR = ../../.. -LIBDIR = ../../lib -TMPDIR = /tmp +export CFLAGS = $(call PKGCFG,cflags) +export CXXFLAGS = $(call PKGCFG,cxxflags) -### Allow user defined options to overwrite defaults: +### The version number of VDR's plugin API: --include $(VDRDIR)/Make.config --include Make.config +APIVERSION = $(call PKGCFG,apiversion) -### The version number of VDR (taken from VDR's "config.h"): +### Allow user defined options to overwrite defaults: -VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) -APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) -ifeq ($(strip $(APIVERSION)),) - APIVERSION = $(VDRVERSION) -endif +-include $(PLGCFG) +-include Make.config ### 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 -DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ### The object files (add further files here): OBJS = $(PLUGIN).o dish.o epghandler.o setupeepg.o equivhandler.o util.o eit2.o -ifdef DBG -CXXFLAGS += -g -endif +### The main target: -### Internationalization (I18N): +all: $(SOFILE) i18n -PODIR = po -I18Npot = $(PODIR)/$(PLUGIN).pot -I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))))) -LOCALEDIR = $(VDRDIR)/locale +### Implicit rules: -### Default Target -default: $(OBJS) +%.o: %.c + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< ### Dependencies: @@ -90,47 +89,50 @@ $(DEPFILE): Makefile -include $(DEPFILE) -### Targets: - -TARGETS = libvdr-$(PLUGIN).so -ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c) -TARGETS += i18n -endif - -all: $(TARGETS) -.PHONY: i18n +### Internationalization (I18N): -%.o: %.c - $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< +PODIR = po +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) +I18Nmsgs = $(addprefix $(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) +I18Npot = $(PODIR)/$(PLUGIN).pot -libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) +%.mo: %.po + msgfmt -c -o $@ $< -$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR)) - xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP -o $@ $^ +$(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 -F --backup=none -q $@ $< + msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $< @touch $@ -%.mo: %.po - msgfmt -c -o $@ $< +$(I18Nmsgs): $(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + install -D -m644 $< $@ + +.PHONY: i18n +i18n: $(I18Nmo) $(I18Npot) + +install-i18n: $(I18Nmsgs) + +### Targets: + +$(SOFILE): $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@ -$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo - @mkdir -p $(dir $@) - cp $< $@ +install-lib: $(SOFILE) + install -D $^ $(LIBDIR)/$^.$(APIVERSION) -i18n: $(I18Nmsgs) +install: install-lib install-i18n -dist: clean +dist: $(I18Npo) clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) - @tar czf $(PACKAGE).tar.gz -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 clean: - @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~ -# @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot + @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ @@ -52,7 +52,7 @@ #include <stdarg.h> -#if APIVERSNUM < 10401 +#if defined(APIVERSNUM) && APIVERSNUM < 10401 #error You need at least VDR API version 1.4.1 for this plugin #endif #if APIVERSNUM < 10507 |