Makefile
author nathan
Sat, 29 Dec 2007 11:20:25 +0100
branchtrunk
changeset 14 feccb11658b1
parent 10 967afc97e51d
child 19 5686936eefc5
permissions -rw-r--r--
release 0.0.8
nathan@0
     1
#
nathan@0
     2
# PremiereEpg plugin to VDR
nathan@0
     3
#
nathan@14
     4
# (C) 2005-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
nathan@0
     5
#
nathan@0
     6
# This code is free software; you can redistribute it and/or
nathan@0
     7
# modify it under the terms of the GNU General Public License
nathan@0
     8
# as published by the Free Software Foundation; either version 2
nathan@0
     9
# of the License, or (at your option) any later version.
nathan@0
    10
#
nathan@0
    11
# This code is distributed in the hope that it will be useful,
nathan@0
    12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
nathan@0
    13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nathan@0
    14
# GNU General Public License for more details.
nathan@0
    15
#
nathan@0
    16
# You should have received a copy of the GNU General Public License
nathan@0
    17
# along with this program; if not, write to the Free Software
nathan@0
    18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
nathan@0
    19
# Or, point your browser to http://www.gnu.org/copyleft/gpl.html
nathan@0
    20
nathan@0
    21
# The official name of this plugin.
nathan@0
    22
# This name will be used in the '-P...' option of VDR to load the plugin.
nathan@0
    23
# By default the main source file also carries this name.
nathan@0
    24
#
nathan@0
    25
PLUGIN = premiereepg
nathan@0
    26
nathan@0
    27
### The version number of this plugin (taken from the main source file):
nathan@0
    28
nathan@0
    29
VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
nathan@0
    30
nathan@0
    31
### The C++ compiler and options:
nathan@0
    32
nathan@0
    33
CXX      ?= g++
nathan@8
    34
CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual
nathan@0
    35
nathan@0
    36
### The directory environment:
nathan@0
    37
nathan@0
    38
VDRDIR = ../../..
nathan@0
    39
LIBDIR = ../../lib
nathan@0
    40
TMPDIR = /tmp
nathan@0
    41
nathan@0
    42
### Allow user defined options to overwrite defaults:
nathan@0
    43
nathan@0
    44
-include $(VDRDIR)/Make.config
nathan@0
    45
nathan@0
    46
### The version number of VDR (taken from VDR's "config.h"):
nathan@0
    47
nathan@10
    48
VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
nathan@10
    49
APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
nathan@10
    50
ifeq ($(strip $(APIVERSION)),)
nathan@10
    51
   APIVERSION = $(VDRVERSION)
nathan@10
    52
endif
nathan@0
    53
nathan@0
    54
### The name of the distribution archive:
nathan@0
    55
nathan@0
    56
ARCHIVE = $(PLUGIN)-$(VERSION)
nathan@0
    57
PACKAGE = vdr-$(ARCHIVE)
nathan@0
    58
nathan@0
    59
### Includes and Defines (add further entries here):
nathan@0
    60
nathan@10
    61
INCLUDES += -I$(VDRDIR)/include
nathan@0
    62
nathan@0
    63
DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
nathan@0
    64
nathan@0
    65
### The object files (add further files here):
nathan@0
    66
nathan@0
    67
OBJS = $(PLUGIN).o
nathan@0
    68
nathan@2
    69
ifdef DBG
nathan@2
    70
CXXFLAGS += -g
nathan@2
    71
endif
nathan@2
    72
nathan@14
    73
### Internationalization (I18N):
nathan@0
    74
nathan@14
    75
PODIR     = po
nathan@14
    76
I18Npot   = $(PODIR)/$(PLUGIN).pot
nathan@14
    77
I18Nmsgs  = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))))
nathan@14
    78
LOCALEDIR = $(VDRDIR)/locale
nathan@0
    79
nathan@0
    80
# Dependencies:
nathan@0
    81
nathan@0
    82
MAKEDEP = $(CXX) -MM -MG
nathan@0
    83
DEPFILE = .dependencies
nathan@0
    84
$(DEPFILE): Makefile
nathan@0
    85
	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
nathan@0
    86
nathan@0
    87
-include $(DEPFILE)
nathan@0
    88
nathan@0
    89
### Targets:
nathan@0
    90
nathan@14
    91
TARGETS = libvdr-$(PLUGIN).so
nathan@14
    92
ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
nathan@14
    93
TARGETS += i18n
nathan@14
    94
endif
nathan@14
    95
nathan@14
    96
all: $(TARGETS)
nathan@14
    97
.PHONY: i18n
nathan@14
    98
nathan@14
    99
%.o: %.c
nathan@14
   100
	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
nathan@0
   101
nathan@0
   102
libvdr-$(PLUGIN).so: $(OBJS)
nathan@0
   103
	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
nathan@10
   104
	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
nathan@0
   105
nathan@14
   106
$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR))
nathan@14
   107
	xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^
nathan@14
   108
nathan@14
   109
%.po: $(I18Npot)
nathan@14
   110
	msgmerge -U --no-wrap -F --backup=none -q $@ $<
nathan@14
   111
	@touch $@
nathan@14
   112
nathan@14
   113
%.mo: %.po
nathan@14
   114
	msgfmt -c -o $@ $<
nathan@14
   115
nathan@14
   116
$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
nathan@14
   117
	@mkdir -p $(dir $@)
nathan@14
   118
	cp $< $@
nathan@14
   119
nathan@14
   120
i18n: $(I18Nmsgs)
nathan@14
   121
nathan@0
   122
dist: clean
nathan@0
   123
	@-rm -rf $(TMPDIR)/$(ARCHIVE)
nathan@0
   124
	@mkdir $(TMPDIR)/$(ARCHIVE)
nathan@0
   125
	@cp -a * $(TMPDIR)/$(ARCHIVE)
nathan@4
   126
	@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
nathan@0
   127
	@-rm -rf $(TMPDIR)/$(ARCHIVE)
nathan@2
   128
	@echo Distribution package created as $(PACKAGE).tar.gz
nathan@0
   129
nathan@0
   130
clean:
nathan@2
   131
	@-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~
nathan@14
   132
	@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot