Makefile
branchtrunk
changeset 14 1d78b544c9de
parent 11 7f424cf3f798
child 22 93aaf15c145a
equal deleted inserted replaced
13:12e31826c483 14:1d78b544c9de
     1 #
     1 #
     2 # MP3/MPlayer plugin to VDR
     2 # MP3/MPlayer plugin to VDR
     3 #
     3 #
     4 # (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
     4 # (C) 2001-2008 Stefan Huelswitt <s.huelswitt@gmx.de>
     5 #
     5 #
     6 # This code is free software; you can redistribute it and/or
     6 # This code is free software; you can redistribute it and/or
     7 # modify it under the terms of the GNU General Public License
     7 # modify it under the terms of the GNU General Public License
     8 # as published by the Free Software Foundation; either version 2
     8 # as published by the Free Software Foundation; either version 2
     9 # of the License, or (at your option) any later version.
     9 # of the License, or (at your option) any later version.
    67 -include $(VDRDIR)/Make.config
    67 -include $(VDRDIR)/Make.config
    68 -include Make.config
    68 -include Make.config
    69 
    69 
    70 ### The version number of this plugin:
    70 ### The version number of this plugin:
    71 
    71 
       
    72 HGARCHIVE = .hg_archival.txt
    72 RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
    73 RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
    73 VERSION := $(shell if test -d .hg; then echo -n '$(RELEASE)-'; (hg identify 2>/dev/null || echo -n Unknown) | sed -e 's/ .*//'; else echo -n '$(RELEASE)'; fi)
    74 RELSTR  := $(shell if test -d .hg; then \
       
    75                      echo -n "-"; (hg identify 2>/dev/null || echo -n "Unknown") | sed -e 's/ .*//'; \
       
    76                    elif test -r $(HGARCHIVE); then \
       
    77                      echo -n "-"; grep "^node" $(HGARCHIVE) | awk '{ printf "%.12s",$$2 }'; \
       
    78                    fi)
       
    79 VERSION := $(RELEASE)$(RELSTR)
    74 
    80 
    75 ### The version number of VDR (taken from VDR's "config.h"):
    81 ### The version number of VDR (taken from VDR's "config.h"):
    76 
    82 
    77 VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
    83 VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
    78 APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
    84 APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)
    85    APIVERSNUM = $(VDRVERSNUM)
    91    APIVERSNUM = $(VDRVERSNUM)
    86 endif
    92 endif
    87 
    93 
    88 ### The name of the distribution archive:
    94 ### The name of the distribution archive:
    89 
    95 
    90 ARCHIVE = $(PLUGIN)-$(VERSION)
    96 ARCHIVE = $(PLUGIN)-$(RELEASE)
    91 PACKAGE = vdr-$(ARCHIVE)
    97 PACKAGE = vdr-$(ARCHIVE)
    92 
    98 
    93 ### Includes and Defines (add further entries here):
    99 ### Includes and Defines (add further entries here):
    94 
   100 
    95 INCLUDES += -I$(VDRDIR)/include
   101 INCLUDES += -I$(VDRDIR)/include
   151 HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h)
   157 HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h)
   152 ifeq ($(strip $(HASLOCALE)),)
   158 ifeq ($(strip $(HASLOCALE)),)
   153   COM_OBJS += i18n.o
   159   COM_OBJS += i18n.o
   154 endif
   160 endif
   155 
   161 
       
   162 ### Targets:
       
   163 
       
   164 ifndef WITHOUT_MP3
       
   165   ALL += libvdr-$(PLUGIN).so
       
   166   ifneq ($(strip $(HASLOCALE)),)
       
   167     ALL += i18n-$(PLUGIN)
       
   168   endif
       
   169 endif
       
   170 ifndef WITHOUT_MPLAYER
       
   171   ALL += libvdr-$(PLUGIN2).so
       
   172   ifneq ($(strip $(HASLOCALE)),)
       
   173     ALL += i18n-$(PLUGIN2)
       
   174   endif
       
   175 endif
       
   176 
       
   177 all: $(ALL)
       
   178 .PHONY: i18n-$(PLUGIN) i18n-$(PLUGIN2)
       
   179 
   156 # Dependencies:
   180 # Dependencies:
   157 
   181 
   158 MAKEDEP = g++ -MM -MG
   182 MAKEDEP = g++ -MM -MG
   159 DEPFILE = .dependencies
   183 DEPFILE = .dependencies
   160 DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c)))
   184 DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c)))
   161 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
   185 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
   162 	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
   186 	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
   163 
   187 
   164 -include $(DEPFILE)
   188 -include $(DEPFILE)
   165 
   189 
   166 ### Targets:
   190 # Rules
   167 
       
   168 ifndef WITHOUT_MP3
       
   169   ALL += libvdr-$(PLUGIN).so
       
   170   ifneq ($(strip $(HASLOCALE)),)
       
   171     ALL += i18n-$(PLUGIN)
       
   172   endif
       
   173 endif
       
   174 ifndef WITHOUT_MPLAYER
       
   175   ALL += libvdr-$(PLUGIN2).so
       
   176   ifneq ($(strip $(HASLOCALE)),)
       
   177     ALL += i18n-$(PLUGIN2)
       
   178   endif
       
   179 endif
       
   180 
       
   181 all: $(ALL)
       
   182 .PHONY: i18n-$(PLUGIN) i18n-$(PLUGIN2)
       
   183 
   191 
   184 %.o: %.c
   192 %.o: %.c
   185 	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
   193 	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
   186 
   194 
   187 libvdr-$(PLUGIN).so: $(OBJS)
   195 libvdr-$(PLUGIN).so: $(OBJS)