Makefile
author nathan
Sat, 29 Dec 2007 11:19:49 +0100
branchtrunk
changeset 10 967afc97e51d
parent 8 b5bd55cfd28f
child 14 feccb11658b1
permissions -rw-r--r--
release 0.0.6
     1 #
     2 # PremiereEpg plugin to VDR
     3 #
     4 # (C) 2005-2006 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 ### Implicit rules:
    74 
    75 %.o: %.c
    76 	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
    77 
    78 # Dependencies:
    79 
    80 MAKEDEP = $(CXX) -MM -MG
    81 DEPFILE = .dependencies
    82 $(DEPFILE): Makefile
    83 	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
    84 
    85 -include $(DEPFILE)
    86 
    87 ### Targets:
    88 
    89 all: libvdr-$(PLUGIN).so
    90 
    91 libvdr-$(PLUGIN).so: $(OBJS)
    92 	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
    93 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
    94 
    95 dist: clean
    96 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
    97 	@mkdir $(TMPDIR)/$(ARCHIVE)
    98 	@cp -a * $(TMPDIR)/$(ARCHIVE)
    99 	@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
   100 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
   101 	@echo Distribution package created as $(PACKAGE).tar.gz
   102 
   103 clean:
   104 	@-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~