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