Makefile
branchtrunk
changeset 0 474a1293c3c0
child 2 4c1f7b705009
equal deleted inserted replaced
-1:000000000000 0:474a1293c3c0
       
     1 #
       
     2 # MP3/MPlayer plugin to VDR
       
     3 #
       
     4 # (C) 2001-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 # You can change the compile options here or create a Make.config
       
    22 # in the VDR directory an set them there.
       
    23 
       
    24 ### uncomment one of these lines, if you don't want one of the plugins
       
    25 #WITHOUT_MP3=1
       
    26 #WITHOUT_MPLAYER=1
       
    27 
       
    28 ### uncomment the following line, if you don't have libsndfile installed
       
    29 #WITHOUT_LIBSNDFILE=1
       
    30 
       
    31 ### uncomment the following line, if you don't have libvorbisfile installed
       
    32 #WITHOUT_LIBVORBISFILE=1
       
    33 
       
    34 ### uncomment the following line, if you want OSS sound output
       
    35 #WITH_OSS_OUTPUT=1
       
    36 
       
    37 ### uncomment the following line, if you want to include debug symbols
       
    38 #DBG=1
       
    39 
       
    40 ### The C++ compiler and options:
       
    41 CXX      ?= g++
       
    42 CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual
       
    43 
       
    44 ###############################################
       
    45 ###############################################
       
    46 #
       
    47 # no user configurable options below this point
       
    48 #
       
    49 ###############################################
       
    50 ###############################################
       
    51 
       
    52 ### The directory environment:
       
    53 
       
    54 VDRDIR = ../../..
       
    55 LIBDIR = ../../lib
       
    56 TMPDIR = /tmp
       
    57 
       
    58 # The official name of this plugin.
       
    59 # This name will be used in the '-P...' option of VDR to load the plugin.
       
    60 # By default the main source file also carries this name.
       
    61 #
       
    62 PLUGIN  = mp3
       
    63 PLUGIN2 = mplayer
       
    64 
       
    65 ### Allow user defined options to overwrite defaults:
       
    66 
       
    67 -include $(VDRDIR)/Make.config
       
    68 
       
    69 ### The version number of this plugin (taken from the main source file):
       
    70 
       
    71 VERSION = $(shell grep 'define PLUGIN_VERSION' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
       
    72 
       
    73 ### The version number of VDR (taken from VDR's "config.h"):
       
    74 
       
    75 VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
       
    76 APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
       
    77 ifeq ($(strip $(APIVERSION)),)
       
    78    APIVERSION = $(VDRVERSION)
       
    79 endif
       
    80 VDRVERSNUM = $(shell sed -ne '/define VDRVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
       
    81 APIVERSNUM = $(shell sed -ne '/define APIVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
       
    82 ifeq ($(strip $(APIVERSNUM)),)
       
    83    APIVERSNUM = $(VDRVERSNUM)
       
    84 endif
       
    85 
       
    86 ### The name of the distribution archive:
       
    87 
       
    88 ARCHIVE = $(PLUGIN)-$(VERSION)
       
    89 PACKAGE = vdr-$(ARCHIVE)
       
    90 
       
    91 ### Includes and Defines (add further entries here):
       
    92 
       
    93 INCLUDES += -I$(VDRDIR)/include
       
    94 DEFINES  += -D_GNU_SOURCE -DAPIVERSNUM=$(APIVERSNUM)
       
    95 
       
    96 ### The object files (add further files here):
       
    97 
       
    98 ifndef WITHOUT_MP3
       
    99   ALL += libvdr-$(PLUGIN).so
       
   100 endif
       
   101 ifndef WITHOUT_MPLAYER
       
   102   ALL += libvdr-$(PLUGIN2).so
       
   103 endif
       
   104 
       
   105 COM_OBJS = i18n.o data.o menu.o
       
   106 
       
   107 OBJS     = $(PLUGIN).o $(COM_OBJS)\
       
   108             data-mp3.o setup-mp3.o player-mp3.o stream.o network.o\
       
   109             decoder.o decoder-mp3.o decoder-mp3-stream.o decoder-snd.o \
       
   110             decoder-ogg.o
       
   111 LIBS     = -lmad -lid3tag
       
   112 
       
   113 ifndef WITHOUT_LIBSNDFILE
       
   114   LIBS    += -lsndfile
       
   115   DEFINES += -DHAVE_SNDFILE
       
   116 endif
       
   117 ifndef WITHOUT_LIBVORBISFILE
       
   118   LIBS    += -lvorbisfile -lvorbis
       
   119   DEFINES += -DHAVE_VORBISFILE
       
   120 endif
       
   121 ifdef WITH_OSS_OUTPUT
       
   122   DEFINES += -DWITH_OSS
       
   123 endif
       
   124 ifdef BROKEN_PCM
       
   125   DEFINES += -DBROKEN_PCM
       
   126 endif
       
   127 
       
   128 OBJS2    = $(PLUGIN2).o $(COM_OBJS)\
       
   129             setup-mplayer.o player-mplayer.o
       
   130 LIBS2    = 
       
   131 
       
   132 ifeq ($(shell test -f $(VDRDIR)/fontsym.h ; echo $$?),0)
       
   133   DEFINES += -DHAVE_BEAUTYPATCH
       
   134 endif  
       
   135 
       
   136 ifdef DBG
       
   137 CXXFLAGS += -g
       
   138 endif
       
   139 
       
   140 ### Implicit rules:
       
   141 
       
   142 %.o: %.c
       
   143 	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
       
   144 
       
   145 # Dependencies:
       
   146 
       
   147 MAKEDEP = g++ -MM -MG
       
   148 DEPFILE = .dependencies
       
   149 $(DEPFILE): Makefile
       
   150 	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) $(OBJS2:%.o=%.c) > $@
       
   151 
       
   152 -include $(DEPFILE)
       
   153 
       
   154 ### Targets:
       
   155 
       
   156 all: $(ALL)
       
   157 
       
   158 libvdr-$(PLUGIN).so: $(OBJS)
       
   159 	$(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
       
   160 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
       
   161 
       
   162 libvdr-$(PLUGIN2).so: $(OBJS2)
       
   163 	$(CXX) $(CXXFLAGS) -shared $(OBJS2) $(LIBS2) -o $@
       
   164 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
       
   165 
       
   166 i18ntest: i18ntest.c i18n.c i18n.h
       
   167 	$(CXX) $(CXXFLAGS) $(INCLUDES) $< -o $@
       
   168 
       
   169 dist: clean
       
   170 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
       
   171 	@mkdir $(TMPDIR)/$(ARCHIVE)
       
   172 	@cp -a * $(TMPDIR)/$(ARCHIVE)
       
   173 	@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
       
   174 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
       
   175 	@echo Distribution package created as $(PACKAGE).tar.gz
       
   176 
       
   177 clean:
       
   178 	@-rm -f $(OBJS) $(OBJS2) $(DEPFILE) i18ntest libvdr-*.so $(PACKAGE).tar.gz core* *~